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

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