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

using namespace std;

int main(){
	string s;
	while(getline(cin, s)){
		vector<string> words;
		int p = 0;
		s += " ";
		for(int i = 0; i < s.size(); ++i){
			if(s[i] == ' ' || s[i] == '.' || s[i] == ','){
				if(3 <= (i - p) && (i - p) <= 6){
					words.push_back(s.substr(p, i - p));
				}
				p = i + 1;
			}
		}
		for(int i = 0; i < words.size(); ++i){
			cout << words[i];
			if(i + 1 == words.size()){
				cout << endl;
			}else{
				cout << " ";
			}
		}
	}
	return 0;
}