#include <string>
#include <iostream>
#include <sstream>
using namespace std;

int main() {
	int i=0;
	string str, word;

	getline(cin, str);
	while(~str.find("."))str[str.find(".")] = ' ';
	while(~str.find(","))str[str.find(",")] = ' ';
	stringstream ss(str);

	while (ss >> word) {
		int len = word.length();
		if(len>=3&&len<=6){
			if(i==0){cout<<word;i++;}
			else    cout<<' '<<word;
		}
	}
	cout<<"\n";
	return 0;
}