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

int main(){
    vector<string> output;
    string input;

    getline(cin, input);

    int i = 0;
    int begin = 0;
    while(i<input.size()){
        if(input[i] == ' ' || input[i] == ',' || input[i] == '.'){
            if(i-begin > 2 && i-begin < 7){
                output.push_back(input.substr(begin, i-begin));
            }
            begin = i + 1;
            i = begin;
        }
        else{
            i++;
        }
    }
    for(int i=0; i<output.size(); i++){
        if(i) cout << " ";
        cout << output[i];
    }
    cout << endl;
    return 0;
}