#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){
		if(s[s.size()-1]==','||s[s.size()-1]=='.'){
			s[s.size()-1]='\0';
		}
		if(s.size()>=3&&s.size()<=6){
			if(f)cout<<" ";
			cout<<s;
			f=true;
		}
	}
	cout<<endl;
}