#include <iostream>
#include <string>

using namespace std;

int main( void )
{
	string buf;
	while(getline(cin, buf)) {
		buf += '.';
		string str = "", output = "";
		int len = buf.size();
		int count = 0;
		bool first = true;
		for(int i=0; i < len; ++i) {
			if(buf[i] != ' ' && buf[i] != '.' && buf[i] != ',') {
				str += buf[i];
				++count;
			}
			else {
				if(2 < count && count < 7) {
					if(first)	first = false;
					else		output += ' ';
					output += str;
				}
				count = 0;
				str = "";
			}
		}
		cout << output << endl;
	}
	return 0;
}