#include <iostream>
#include <string>
#include <vector>

using namespace std;

void solve()
{
	string str;
	getline(cin, str);
	int size = str.size();
	string s;
	vector<string> Vec;
	for(int i = 0; i < size; ++i)
	{
		if(str[i] == ' ' || str[i] == ',' || str[i] == '.')
		{
			if(s.empty())
			{
				continue;
			}
			Vec.push_back(s);
			s.clear();
		}
		else
		{
			s += str[i];
		}
	}
	bool flag = true;
	for(int i = 0; i < Vec.size(); ++i)
	{
		if(3 <= Vec[i].size() && Vec[i].size() < 7)
		{
			if(!flag)
			{
				cout << " ";
			}
			cout << Vec[i];
			flag = false;
		}
	}
	cout << endl;
}

int main()
{
	solve();
	return(0);
}