#include <iostream>
#include <cstdio>
#include <set>
using namespace std;
string input;
string list[1024 / 6];
int idx = 0;

bool w_space(char a) {
    return(a == ' ' || a == '.' || a == ',');
}

bool legal(string str) {
    if(str.length() <= 2 || str.length() >= 7) return(false);
    return(true);
}

void solve() {
    string check = "";
    for(int r = 0; r < input.length(); r++) {
        if(w_space(input[r])) {
            if(legal(check)) {
                list[idx++] = check;
            }
            check = "";
        } else {
            check += input[r];
        }
    }
}

int main(void) {
    getline(cin, input);
    
    solve();
    /*
    set<string>::iterator ite = list.begin();
    for(int r = 0; r < list.size(); r++, ite++) {
        cout << (*ite);
        if(r == list.size() - 1) putchar('\n');
        else putchar(' ');
    }
     */
    
    for(int r = 0; r < idx; r++) {
        cout << list[r];
        if(r == idx - 1) putchar('\n');
        else putchar(' ');
    }
    return(0);
}