#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
using namespace std;
int stoi(string x){stringstream ss;ss<<x;int tmp;ss>>tmp;return tmp;}
string itos(int x){stringstream ss;ss<<x;return ss.str();}
int main(){
	string n,tmp;
	getline(cin,n);
	vector<string>ta;
	for(int i=0;i<=n.size();i++){
	if(n[i]==' '||n[i]==','||n[i]=='.'||i==n.size()){
	if(tmp.size()>=3&&tmp.size()<=6)ta.push_back(tmp);
	tmp.clear();
	}
	else tmp.push_back(n[i]);
	}
	for(int i=0;i<ta.size();i++)(i==ta.size()-1)?cout<<ta[i]<<endl:cout<<ta[i]<<" ";
	return 0;
}