#include<iostream>
#include<string>
#include <algorithm>
using namespace std;
int main()
{
	string s;
	string ma;
	int pl = 0;
	bool flag = false;
	getline(cin, s);
	replace(s.begin(), s.end(), ',', ' ');
	replace(s.begin(), s.end(), '.', ' ');
	for (int i = 0; i < s.size(); i++){
		if (s[i] == ' ' || s[i] == '\n'){
			if (ma.size() >= 3 && ma.size() <= 6){
				if (flag){
					cout << " ";
				}
				flag = true;
				cout << ma;
			}
		ma.clear();
		}
		else{
			ma += s[i];
		}
	}
	cout << endl;
}