#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

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

    s += ".";
    int l = s.size(), cnt = 0;
    bool sec = false;
    REP(l)
    {
        if(s[i] == ' ' || s[i] == '.' || s[i] == ',')
        {
            if(cnt>=3 && cnt <=6)
            {
                if(sec) cout << " " ;
                cout << s.substr(i - cnt, cnt); 
                sec = true;
            }
            cnt = 0;
        }
        else cnt++;
    }
    cout << endl;
    return 0;
}