#include <bits/stdc++.h>
#define range(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,n) range(i,0,n)
using namespace std;

int main(void){
	string s;
	getline(cin,s);
	vector<string> ans;
	string cur="";
	rep(i,s.size()){
		if(s[i]==' '||s[i]==','||s[i]=='.'){
			int m=cur.size();
			if(3<=m&&m<=6) ans.push_back(cur);
			cur="";
		}else
			cur+=s[i];
	}
	rep(i,ans.size()){
		cout << (i?" ":"") << ans[i];
	}
	cout << endl;
	return 0;
}