#include<bits/stdc++.h>
using namespace std;
int main()
{
    string str;
    getline(cin,str);
    int point=0,co=0;
    for(int i=0;str[i-1]!='\0';i++){
        if(str[i]==' '||str[i]=='.'||str[i]==','){
            if(i-point>2&&i-point<7){
                if(co==1)cout<<" ";
                for(int j=point;j<i;j++){
                    cout<<str[j];
                }
                co=1;
            }
            point=i+1;
        }
    }
    cout<<endl;
}