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

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

    string ans = "", t = "";
    for (int i=0; i<(int)s.size(); ++i) {
        if (s[i] == ' ' || s[i] == '.' || s[i] == ',') {
            if (3 <= (int)t.size() && (int)t.size() <= 6) {
                ans += " " + t;
            }
            t = "";
        } else {
            t += s[i];
        }
    }
    cout << ans.substr(1) << endl;
    return 0;
}