#include <iostream>
#include <string>
using namespace std;
int main(int argc, const char * argv[])
{
    string str;
    string stuck;
    string result;
    int first = 1;
    int strnum = 0;
    getline(cin, str);
    for (int i = 0; i < str.size(); i++) {
        if (str[i] == ',' || str[i] == '.' || str[i] == ' ') {
            if (2 < strnum && strnum < 7) {
                if (first) {
                    first--;
                }
                else {
                    result += ' ';
                }
                result += stuck;
            }
            strnum = 0;
            stuck = "";
        }
        else {
            stuck += str[i];
            strnum++;
        }
    }
    cout << result << endl;
    return 0;
}