#include <iostream>
#include <string>
#include <sstream>
#include <vector>
using namespace std;

int main()
{
    string s;
    getline(cin, s);

    for(auto& c: s) if (c==',' or c=='.') c=' ';

    istringstream is(s);
    string t;
    vector<string> res;
    while (is>>t) if (2<t.size() and t.size()<7) res.push_back(t);

    for(int i=0; i<res.size(); ++i)
        cout<<res[i]<<(i+1<res.size() ? ' ' : '\n');
}