#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
using namespace std;

string s,t,u;

int main(){
	getline(cin,s);
	int cur=0,f=0;
	while(cur<s.size()){
		if(s[cur]!=' '&&s[cur]!='.'&&s[cur]!=','){u=s[cur];t+=u;}
		else{
			if(t.size()>2&&t.size()<7){if(f)cout<<" ";cout<<t;f=1;}
			t="";
		}
		cur++;
	}
	if(t.size()>2&&t.size()<7){if(f)cout<<" ";cout<<t;}
	cout<<endl;
}