#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>

typedef long long int ll;


using namespace std;

string s;

int main(){
	bool f=false;
	while(cin>>s){
		int len=s.size();
		if(s[len-1]==','||s[len-1]=='.'){
			s[len-1]='\0';
			len--;
		}
		if(len>=3&&len<=6){
			if(f)cout<<" ";
			cout<<s;
			f=true;
		}
	}
	cout<<endl;
}