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