#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()

#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,a,b) for(int i=(a); i<(b); i++)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-10;
//int mod=1000000007;


vector<string> split(string s,char c){
	stringstream ss(s);
	string t;
	vector<string> ret;
	while(getline(ss,t,c)){
		ret.pb(t);
	}
	return ret;
}



int main(){
	string s;
	getline(cin,s);
	vector<string> v=split(s,' ');
	set<string> se;
	bool f=false;
	for(int i=0; i<v.size(); i++){
		s=v[i];
		while(s[s.size()-1]==','||s[s.size()-1]=='.'){
			s.resize(s.size()-1);
		}
		if(s.size()>=3&&s.size()<=6){
			if(se.count(s)==0){
				if(f)cout<<" ";
				cout<<s;
				f=true;
				se.insert(s);
			}
		}
	}
	cout<<endl;
}