#include<iostream>
#include<string>
int main(){
	std::string s;
	char k[6+1];
	int l=0,i=0,j=0;
	getline(std::cin,s);
	
	while(1){
		if(s[i] == '.' || s[i] == ',' || s[i] == ' ' || s[i] == '\0'){
			if(l>=3 && l<=6){
				k[l] = '\0';
				std::cout << (j?"":" ") << k;
				++j;
			}
			l=0;
			++i;
			
			if(s[i]=='\0')
				break;
		}
		k[l] = s[i];
		++l;
		
		++i;
	}
}