#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>

using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 999999
#define rep(i,j) for(int i=0;i<(j);++i)
#define reps(i,j,k) for(int i=j;i<k;++i)
typedef long long ll;
typedef unsigned long long ull;

int main(){
	string str;
	getline(cin,str);
	int cnt = 0;
	int len = str.size();
	string ans;
	bool f = true;
	rep(i,len){
		if(str[i] == ' '){
			if(cnt < 3 || cnt > 6){
				ans = "";
				cnt = 0;
			}
			else{
				if(f)cout << ans;
				if(!f)cout << " " << ans;
				f = false;
				cnt = 0;
				ans = "";
			}
		}
		else{
			if(str[i] == ',' || str[i] == '.')continue;
			cnt++;
			ans += str[i];
		}
	}
	if(cnt > 2 && cnt < 7)cout << " " << ans;
	cout << endl;
	return 0;
}