#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
int main() {
	string s;
	bool flag = 0;
	while(cin >> s) {
		if(s[s.length()-1] != ',' && s[s.length()-1] != '.') {
			if(s.length() > 2 && s.length() < 7) {
				if(flag) cout << " " << s;
				else {
					flag = 1;
					cout << s;
				}
			}
		} else {
			if(s.length() > 3 && s.length() < 8) {
				s.erase(--s.end());
				if(flag) cout << " " << s;
				else {
					flag = 1;
					cout << s;
				}
			}
		}
	}
	return 0;
}