#include <iostream>

using namespace std;

int main()
{
    string inp;
    bool flag = false, fst = false;
    int len = 0;
    int idx = 0;

    getline(cin, inp);
    inp += '.';
    for (int i = 0; i < inp.size(); i++) {
        if (inp[i] == ' ' || inp[i] == ',' || inp[i] == '.') {
            if (flag && len >= 3 && len <= 6) {
                if (fst)
                    cout << " ";
                else
                    fst = true;
                cout << inp.substr(idx, len);
                flag = false;
            }
            else 
                flag = false;
        }
        else {
            if (flag) 
                len++;
            else {
                idx = i;
                len = 1;
                flag = true;
            }
        }
    }
    cout << endl;

    return 0;
}