#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

int main() {
	vector<string> strings;
	string s;
	while (cin >> s) {
		while (s.find(",", 0) != string::npos) {
			s.erase(s.find(",", 0));
		}
		while (s.find(".", 0) != string::npos) {
			s.erase(s.find(".", 0));
		}
		if (3 <= s.size() && s.size() <= 6)
			strings.push_back(s);
	}
	vector<string>::iterator it = strings.begin();
	int ifs = 1;
	while (it != strings.end()) {
		if (ifs == 0)
			cout << " ";
		cout << *it;
		ifs = 0;
		it++;
	}
	cout << endl;
	return 0;
}