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

using namespace std;

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