#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

vector<string> split(std::string str, char del)
{
	int first = 0;
	int last = str.find_first_of(del);

	vector<string> result;

	while (first < str.size())
	{
		string sub_str(str, first, last - first);

		result.push_back(sub_str);

		first = last + 1;
		last = str.find_first_of(del, first);

		if (last == string::npos)
		{
			last = str.size();
		}
	}

	return result;
}

int main()
{
	string str;

	bool f = false;

	getline(cin, str);
	vector<string> s = split(str, ' ');
	
	for (int i = 0; i < s.size(); i++)
	{
		string t;
		if (s.at(i).back() == '.' || s.at(i).back() == ',')
		{
			for (int j = 0; j < s.at(i).length() - 1; j++)
			{
				t += s.at(i).substr(j, 1);
			}
		}
		else
		{
			t = s.at(i);
		}

		if (3 <= t.length() && t.length() <= 6)
		{
			cout << (!f ? "" : " ") << t;
			f = true;
		}
	}
	
	cout << endl;
}

