#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps = 1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.txt"


int main() {
	string st;
	getline(cin, st);
	int a = -1;
	vector<string>anss;
	while (1) {
		int b = st.size();
		for (int i = a + 1; i < st.size(); ++i) {
			if (st[i] == ',' || st[i] == ' ' || st[i] == '.') {
				b = i;
				break;
			}
		}
		if (b == st.size())break;
		string name = st.substr(a + 1, b - a - 1);
		if (name.size() <= 6 && name.size() >= 3) {
			anss.emplace_back(name);
		}
		a = b;
	}
	for (int i = 0; i < anss.size(); ++i) {
		cout << anss[i];
		if (i == anss.size() - 1)cout << endl;
		else cout << " ";
	}
	return 0;
}