#include <cstring>
#include <iostream>
#include <string>
using namespace std;
int main(){
	string s;
	getline(cin,s);
	char *q,*p,*c=new char[sizeof(s)+1];
	int f=0,n;
	strncpy(c,s.c_str(),s.size()+1);
	p=strtok(c," .,");
	while(p!=NULL){
		n=string(p).size();
		if(3<=n&&n<=6){
			cout<<((f==1)?" ":"\0")<<p;
			f=1;
		}
		p=strtok(NULL," .,");
	}
	cout<<endl;
}