#include <bits/stdc++.h>
using namespace std;

int main(){
    string input;
    string del = ",.";
    vector<string> ans;
    getline(cin, input);
    input += " ";
    while(input.find_first_of(" ") != string::npos){
        string s = input.substr(0, input.find_first_of(" "));
        if(del.find(input.substr(s.size()-1, 1)) != string::npos) s = s.substr(0, s.size()-1);
        if(3 <= s.size() && s.size() <= 6) ans.push_back(s);

        input = input.substr(input.find_first_of(" ")+1);
    }
    for(int i=0; i < ans.size(); i++){
        if(i == 0) cout << ans[i];
        else cout << " " << ans[i];
    }
    cout << endl;
}