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

int main(){
	string s;
	getline(cin, s);
	const char *p = s.c_str();
	bool space = false;
	char buf[1100] = "";

	while(*p){
		int d = 0;
		sscanf(p, "%*[ .,]%n", &d);
		p += d;
		if(sscanf(p, "%[^ .,]", buf) == 1){
			string t = buf;
			p += t.size();
			if(t.size() >= 3 && t.size() <= 6){
				if(space){ cout << ' '; }
				space = true;
				cout << t;
			}
		}
	}
	cout << endl;
}