#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s;
    std::deque<string> deq;
    while (cin>>s) {
        if (s.at(s.size()-1)=='.'||s.at(s.size()-1)==',') {
            s=s.substr(0,s.size()-1);
        }
        if (s.size()>=3&&s.size()<=6) {
            deq.emplace_back(s);
        }
    }
    for (int i=0;i<deq.size();i++) {
        if (i==deq.size()-1) {
            cout<<deq[i]<<endl;
        } else {
            cout<<deq[i]<<" ";
        }
    }
}

