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

int main() {
    string s;
    getline(cin, s);
    
    string buf;
    vector<string> words;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != ' ' && s[i] != '.' && s[i] != ',') {
            buf.push_back(s[i]);
        } else {
            if (3 <= buf.size() && buf.size() <= 6) {
                words.push_back(buf);
            }
            buf.clear();
        }
    }
    cout << words[0];
    for (int i = 1; i < words.size(); i++) {
        cout << ' ' << words[i];
    }
    cout << endl;
    return 0;
}