#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
	string buffer;

	getline( cin, buffer );

	for ( unsigned int i = 0; i < buffer.length(); i++ )
	{
		if ( buffer[i] == '.' || buffer[i] == ',' )
		{
			buffer[i] = ' ';
		}
	}

	istringstream iss( buffer );

	string word;
	bool first = true;
	while ( iss >> word )
	{
		unsigned l = word.length();

		if ( 3 <= l && l <= 6 )
		{
			if ( !first )
			{
				cout << ' ';
			}
			else
			{
				first = false;
			}

			cout << word;
		}
	}
	cout << endl;

	return 0;
}