#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	string sent;
	vector<string> word;
	int st = 0, ed, cnt = 0;

	getline(cin , sent);

	while(1)
	{
		if(cnt > sent.size())
		{
			break;
		}
		if( (sent[cnt] == ',' || sent[cnt] == ' ' || sent[cnt] == '.') && st != -1)
		{
			if((cnt-st) >= 3 && (cnt-st) <= 6)
			{
				word.push_back(sent.substr(st, cnt-st));
			}
			st = -1;
		}
		else if( (sent[cnt] != ',' && sent[cnt] != ' ' && sent[cnt] != '.') ) 
		{
			if(st == -1)
			{
				st = cnt;
			}
		}
		cnt++;
	}

	for(int i = 0; i < word.size(); i++)
	{
		printf("%s%c", word[i].c_str(), (i == word.size()-1)?'\n':' ');
	}

}