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

int main(){
	string str, s;

	while( getline(cin,str) ){
		bool flag = false;
		s = "";
		for(int i=0 ; i<str.size() ; i++){
			if( str[i] == ' ' || str[i] == '.' || str[i] == ',' ){
				if( s.size() >= 3 && s.size() <= 6 ){
					if(flag){
						cout << " " << s ;
					}else{
						flag = true;
						cout << s;
					}
				}
				s = "";
			}else{
				s += str[i];
			}
		}
		cout << endl;
	}
	return 0;
}