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

int main() {
	string s;
	getline(cin, s);
	vector<string>v;

	string sa;

	for (int i = 0;i < s.size();i++) {
		if (s[i] == ' ' || s[i] == ','||s[i] == '.'||i+1==s.size()) {
			if (sa.size() >= 3 && sa.size() <= 6)v.push_back(sa);
			sa.clear();
		}
		else sa.push_back(s[i]);
	}

	int a = v.size();
	for (int i = 0;i < a;i++) {
		cout << v[i];
		if (i + 1 != a)cout << ' ';
		else cout << endl;
	}
	return 0;
}