#include <iostream>
#include <sstream>
#include <string>
using namespace std;
int main(){
	string s;
	bool start = true;
	while(cin >> s){
		int sn = 1;
		int en = s.size();
		char b = s[0];
		char c = s[s.size()-1];
		if(b==',' or b=='.') sn++;
		if(c==',' or c=='.') en--;
		int n = en - sn + 1;
		if(n>=3 and n<=6){
			if(start){ cout << s.substr(sn-1,n); start = false; }
			else cout << " " << s.substr(sn-1,n);
		}
	}
}