#include <iostream>
#include <string>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main() {
    string st;
    getline(cin, st);
    int cnt = 0;
    bool first = true;

    rep(i, st.length()) {
        char c = st[i];
        if (c == ' ' || c == '.' || c == ',') {
            if (cnt >= 3 && cnt <= 6) {
                if (first) {
                    first = false;
                }
                else {
                    cout << " ";
                }
                for (int j = i - cnt; j < i; j++) {
                    cout << st[j];
                }
            }
            cnt = 0;
        }
        else {
            cnt++;
        }
    }

    return 0;
}