#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
int main()
{
	string s;
	while(getline(cin,s))
	{
		replace(s.begin(),s.end(),',',' ');
		replace(s.begin(),s.end(),'.',' ');
		int count=0;
		bool up=true;
		for(int i=0;i<s.size();i++)
		{
			if(s[i]!=' ')
			{
				count++;
			}
			else
			{
				if(3<=count&&count<=6)
				{
					if(up)
					{
						up=false;
					}
					else
					{
						cout << ' ';
					}
					for(int j=i-count;j<i;j++)
					{
						cout << s[j];
					}
					count=0;
				}
				else
				{
					count=0;
				}
			}
		}
		cout << endl;
	}
	return 0;
}