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