#include <bits/stdc++.h>
using namespace std;

int main() {
    vector<string> ans;
    string s;
    while(cin >> s) {
        string now;
        for(auto c : s) {
            if(c == '.' || c == ',') {
                if(3 <= now.size() && now.size() <= 6) {
                    ans.push_back(now);
                }
                now.clear();
            } else {
                now += c;
            }
        }
        if(3 <= now.size() && now.size() <= 6) {
            ans.push_back(now);
        }
    }
    for(int i = 0; i < (int)ans.size(); ++i) {
        cout << ans[i] << " \n"[i + 1 == (int)ans.size()];
    }
}
