#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
bool space(char c){
    return(c==' '||c==','||c=='.');
}
int main(){
    string str;
    getline(cin,str);
    string word;
    bool f=false;
    for(int i=0;i<str.length();i++){
        if(space(str[i])){
            if(word.length()>=3&&word.length()<=6){
                if(f)cout<<" ";
                cout<<word;
                f=true;
            }
            word="";
        }
        else word+=str[i];
    }
    cout<<endl;
}