#include <iostream>
#include <string>

int main() {
	std::string str, word;
	std::string::size_type index=0, index2;
	std::string::size_type finds, findc, findp;
	bool flg=false;

	// Input a sentence
	while(std::cin >> str) {
		
		index = index2 = 0;
		
		if(flg) std::cout <<  " ";

		flg = false;
		
		while(1) {
			finds = str.find(" ", index); finds = ( finds==std::string::npos ? str.length() : finds );
			findc = str.find(".", index); findc = ( findc==std::string::npos ? str.length() : findc );
			findp = str.find(",", index); findp = ( findp==std::string::npos ? str.length() : findp );
			// Select Minimum
			index2 = ( finds>findc ? findc : finds );
			index2 = ( index2>findp ? findp : index2 );
			
			word = str.substr( index, index2);
			if( 3<=word.length() && word.length()<=6 ) {std::cout << word; flg=true;}
			
			if(finds==str.length() && findc==str.length() && findp==str.length()) break;
			index += index2+1;
		}
	}

	return 0;
}