#include <iostream>
#include <cctype>
using namespace std;

int main() {
    string line;
    int cnt, spos;
    bool first = true;

    getline(cin, line);
    line += " ";
    cnt = 0;
    for (int i = 0, l = line.size()-1; i < l; i++) {
        if (line[i] != ' ' && line[i] != '.' && line[i] != ',') {
            if (cnt == 0) spos = i;
            cnt++;
        }
        else {
            if (2 < cnt && cnt < 7) {
                if (!first) cout << " ";
                first = false;
                cout << line.substr(spos, cnt);
            }
            cnt = 0;
        }
    }
    cout << endl;

    return 0;
}