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

bool issep( char ch )
{
	return ch == ' ' || ch == '.' || ch == ',';
}

std::string s;

std::vector<std::string> split()
{
	std::vector<std::string> ret;
	std::string::size_type i = 0, j = 0;

	while( i < s.size() && j < s.size() )
	{
		while( i < s.size() && issep( s[i++] ) );
		--i;

		j = i;

		while( j < s.size() && !issep( s[++j] ) );

		if( i < j )
		{
			std::string t = s.substr( i, j - i );

			if( 3 <= t.size() && t.size() <= 6 )
				ret.push_back( t );

			i = j + 1;
		}
	}

	return ret;
}

int main()
{
	std::getline( std::cin, s );

	std::vector<std::string> v = split();
	for( int i = 0; i != v.size(); ++i )
		( i ? std::cout << " " : std::cout ) << v[i];

	std::cout << std::endl;

	return 0;
}