#include <vector>
#include <string>
#include <iostream>
#include <sstream>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)

int main(){
    string in;
    getline(cin,in);
    rep(i,in.size())
        if(string(",.").find(in[i])!=string::npos)
            in[i]=' ';
    vector<string> ans;
    stringstream ss(in);
    string buf;
    while(ss>>buf){
        if(3<=buf.size() && buf.size() <=6)
            ans.push_back(buf);
    }
    rep(i,ans.size()){
        cout<<ans[i]<<(i!=ans.size()-1 ? ' ' : '\n');
    }
}