#include<cstdio>
#include<iostream>
#include<string>

using namespace std;

int main(void){

	char inp;
	int cnt=0,cnt2=0;
	int ok=0;
	string word[1024*2];

	while(1){
		inp=getchar();
		if(inp=='\n') break;
		if(inp!=','&&inp!='.'&&inp!=' '){
			word[cnt]+=inp;
		}
		else{
			if(word[cnt].length()>=3&&word[cnt].length()<=6) ok++;
			cnt++;
		}
	}
	for(int i=0;i<cnt;i++){
		if(word[i].length()>=3&&word[i].length()<=6){
			cnt2++;
			if(cnt2==ok) cout<<word[i]<<endl;
			else cout<<word[i]<<" ";
		}
	}
	
	return 0;
}