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

int main(){
    string in;
    vector<string> words;
    getline( cin, in );
    for(int i=0; i<in.length(); i++) {
        string w = "";
        while( i<in.length() && in[i]!=' ' && in[i]!='.' && in[i]!=',' ) {
            w += in[i];
            i++;
        }
        if( 3<=w.length() && w.length()<=6 ) {
            words.push_back(w);
        }
    }
    for(int i=0; i<words.size()-1; i++) {
        cout << words[i] << " ";
    }
    cout << words[words.size()-1] << endl;
    return 0;
}