#include <bits/stdc++.h>
using namespace std;

char str[2048];

bool is_punc(char c){
	return c == ' ' || c == '.' || c == ',';
}

int main(){
	fgets(str,sizeof(str),stdin);
	int len = strlen(str);
	int state = 0; // 0->inval,1->reading
	int ptr = 0;
	bool first = true;

	str[len] = ' ';
	for(int i = 0; i < len; i++){
		if(state == 0){
			if(is_punc(str[i])){
				state = 0;
			}
			else{
				state = 1;
				ptr = i;
			}
		}
		else if (state == 1){
			if(is_punc(str[i])){
				state = 0;
				if(i-ptr >= 3 && i-ptr <= 6){
					if(!first){
						printf(" ");
					}
					for(int j = ptr; j < i; j++){
						printf("%c",str[j]);
						first = false;
					}
				}
			}
			else{
				state = 1;
			}
		}
	}
	printf("\n");
	return 0;
}

