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

int main()
{
	int i, count;
	bool f;
	string s;
	stringstream ss;

	getline(cin, s);
	ss.str("");
	count = 0;
	f = false;
	for (i = 0; i < s.size(); i++) {
		if (s[i]==' ' || s[i]==',' || s[i]=='.') {
			if (3<=count && count<=6) {
				if (f) cout<<" ";
				cout<<ss.str();
				f = true;
			}
			ss.str("");
			count = 0;
			continue;
		}
		count++;
		ss<<s[i];
	}
	cout<<endl;
	return 0;
}