#include<iostream>
#include<vector>
using namespace std;

int main(){
    vector<string>vec;
    string str,s;
    getline(cin,str);
    int i;
    for(i=0;i<str.length();i++){
        if(str[i]!='.'&&str[i]!=','&&str[i]!=' ')
            s+=str[i];
        else{
            if(s.length()>2&&s.length()<7)
                vec.push_back(s);
            s="";
        }
    }
    for(i=0;i<vec.size()-1;i++)
        cout<<vec[i]<<" ";
    cout<<vec[i]<<endl;
}