#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void){
	string str;
	
	while(getline(cin,str)){
		int begin=0;
		int length=0;
		int n = str.size();
		vector<string> ret;
		string tmp="";
		
		for(int i=0;i<n;i++){
			if(str[i] == ' ' || str[i] == ',' || str[i] == '.'){
				if(3 <= length && length <= 6){
					ret.push_back(tmp);
				}
				length = 0;
				tmp.clear();
			}else{
				tmp += str[i];
				length++;
			}
		}
		for(int i=0;i<ret.size();i++){
			if(i == ret.size()-1){
				cout << ret[i] << endl;
			}else{
				cout << ret[i] << " ";
			}
		}
	}
}