#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

int main() {
	string str;
	int counter[2] = {0};
	int hantei = 0;

	getline(cin, str);
	
	for (int i = 0; i < str.length(); i++) {
		if (str[i] == '.' || str[i] == ',' || str[i] == ' ') {
			if (2 < counter[0] && counter[0] < 7 && hantei == 1) {
				cout << " " << str.substr(counter[1],counter[0]);
			} else if (2 < counter[0] && counter[0] < 7 && hantei == 0) {
				cout << str.substr(counter[1],counter[0]);
				hantei = 1;
			}
			counter[0] = 0;
		} else {
			if (counter[0] == 0) {
				counter[1] = i;
			}
			counter[0]++;
		}
	}

	cout << endl;

	return 0;
}