#include<iostream>
#include<string>
using namespace std;
int main() {
	string s;
	getline(cin, s);
	string str;
	bool b = false;
	for (int i = 0; i < s.size(); i++){
		if (s[i] == ' ' || s[i] == '.' || s[i] == ',') {
			if (str.size() >= 3 && str.size() <= 6) {
				if (b)cout << ' ';
				else b = true;
				cout << str;
			}
			str.clear();
		}
		else str += s[i];
	}
	if(b) cout << endl;
	return 0;
}