#include<sstream>
using namespace std;
int main(){
	string s; getline(cin,s);
	for(int i=0;i<s.size();i++)if(s[i]=='.'||s[i]==',')s[i]=' ';
	
	stringstream ss; ss<<s;
	bool f=0;
	while(ss>>s)if(s.size()>2&&s.size()<7){
		if(f)cout<<" "; f=1;
		cout<<s;
	}
	cout<<endl;
	
	return 0;
}