#include<iostream>
#include<vector>
#define N 1025
using namespace std;

void disp(vector<char> tmp);

int main(){
    bool firflg = true;
    char inp[N];
    vector<char> tmp;
    cin.getline(inp, sizeof(inp));
    for(int i = 0; inp[i] != '\0'; i++){
        if(inp[i] != ' ' && inp[i] != ',' && inp[i] != '.'){
            tmp.push_back(inp[i]);
        } else{
            if(tmp.size() >= 3 && tmp.size() <= 6){
                if(!firflg){
                    cout <<" ";
                }
                firflg = false;
                disp(tmp);
            }
            tmp.clear();
        }
    }
    cout <<endl;
    return 0;
}

void disp(vector<char> tmp){
    for(int i = 0; i < tmp.size(); i++){
        cout <<tmp[i];
    }
}
//00:24:05