#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<stack>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;

int main(){
	char W[1025],ans[1024][7];
	int clen=0,cans=0;;
	while(scanf("%c",&W[clen]),W[clen]!='\n'){
		if(W[clen]==' ' || W[clen]==',' || W[clen]=='.'){
			W[clen] = '\0';
			if(3<=clen && clen<=6){
				strncpy(ans[cans],W,clen+1);
				cans++;
			}
			clen = 0;
		}
		else clen++;
	}
	if(cans!=0) printf("%s",ans[0]);
	for(int i=1;i<cans;i++){
		printf(" %s",ans[i]);
	}puts("");
	return 0;
}