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

using namespace std;

int main()
{
	int count = 0, i;
	string str, tmp;
	bool first = true;
	
	getline(cin, str);
	
	for (i=0; i<1025 && str[i] != '\0'; i++) {
		if (str[i] != ' ' && str[i] != ',' && str[i] != '.') {
			tmp[count++] = str[i];
		} else {
			tmp[count] = '\0';
			if (count >= 3 && count <= 6)
				if (first) {
					cout << tmp.c_str() << flush;
					first = false;
				} else
					cout << " " << tmp.c_str() << flush; 
			count = 0;
		}
	}
	cout << endl;
	
	return 0;
}