#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main(){
	string s;
	while ( getline( cin, s ) ){
		bool first = true;
		istringstream iss( s );
		while ( !iss.eof() ){
			iss >> s;
			int len = s.size();
			char c = s[ len - 1 ];
			if ( c == '.' || c == ',' ){
				s.erase( len - 1, 1 );
				len -= 1;
			}
			if ( len >= 3 && len <= 6 ){
				if ( first ){
					first = false;
					cout << s;
				}else{
					cout << " " << s;
				}
			}
		}
		cout << endl;
	}
	return 0;
}