#include <iostream>
#include <string>

using namespace std;

void solve()
{
	string str;
	while(getline(cin, str))
	{
		string s;
		bool flag = false;
		for(int i = 0; i < str.size(); ++i)
		{
			if(str[i] == ' ' || str[i] == ',' || str[i] == '.')
			{
				if(3 <= s.size() && s.size() <= 6)
				{
					if(flag)
					{
						cout << " " << s;
					}
					else
					{
						cout << s;
						flag = true;
					}
				}
				s = "";
			}
			else
			{
				s += str[i];
			}
		}
		cout << endl;
	}
}

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