#include <iostream>
using namespace std;
int main(){
	string s;
	while(getline(cin,s)){
		string tmp;
		for(int i=0;i<s.size();++i){
			if(s[i]==','||s[i]=='.'||s[i]==' '||i==s.size()-1){
				if(3<=tmp.size()&&tmp.size()<=6) cout<<tmp<<" ";
				tmp="";
			}else tmp+=s[i];
		}
		cout << "\n";
	}
	return 0;
}