#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<sstream>
using namespace std;
int main(void){

    string str,tmp;
    getline(cin,str);
    for(int i=0;i<str.size();i++)if(str[i]==','||str[i]=='.')str[i]=' ';
    stringstream ss(str);
    bool flg = 0;
    while(ss>>tmp){

        int x = tmp.size();
        if(tmp[x-1]=='.'||tmp[x-1]==',')tmp.erase(--x);
        if(2<x&&x<7){
            if(flg)cout<<" ";
            cout<<tmp;
            flg = 1;
        }


    }
    cout<<endl;


    return 0;
}