#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <climits>
#include <cfloat>

using namespace std;

char buf[2000];

int main()
{
	cin.getline(buf, sizeof(buf));
	vector<pair<int, int> > v;
	int start = 0;
	for (int i = 0; buf[i] != '\0'; ++i)
	{
		char c = buf[i];
		if (c == ' ' || c == ',' || c == '.')
		{
			int len = i - start;
			if (3 <= len && len <= 6)
				v.push_back(make_pair(start, i-1));
			start = i+1;
		}
	}

	for (int i = 0; i < v.size(); ++i)
	{
		for (int j = v[i].first; j <= v[i].second; ++j)
			putchar(buf[j]);
		if (i != v.size()-1)
			putchar(' ');
	}
	putchar('\n');

	return 0;
}