#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout << fixed << setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

signed main()
{
	string inp;
	getline(cin, inp);
	replace(ALL(inp), ',', ' ');
	replace(ALL(inp), '.', ' ');
	stringstream ss(inp);
	vector<string>words;
	string s; while (ss >> s) if (3 <= s.length() && s.length() <= 6)words.push_back(s);
	auto itr = unique(ALL(words));
	REP(i, itr - words.begin()) {
		if (i != 0)cout << ' ';
		cout << words[i];
	}
	cout << endl;
}
