#include<iostream>
#include<string>
using namespace std;
int main()
{
    string s;
    string ma;
    int pl = 0;
    getline(cin, s);
    for (int i = 0; i < s.size(); i++){
        if (s[i] == '.' || s[i] == ',' || s[i] == ' '){
            ma.clear();
            for (int i2 = pl; i2 < i; i2++){
                ma += s[i2];
            }
            if (s[i] == '.' || s[i] == ','){
                pl = i+2;
            }
            else{
                pl = i+1;
            }
            if (ma.size() >= 3 && ma.size() <= 6){
                cout << ma << " ";
            }
        }
    }
    cout << endl;
}