#include <iostream>
#include <vector>
#include <string>
#include <stack>
using namespace std;
int main() {
    string str;
    getline(cin, str);
    int begin = 0;
    string moji;
    vector<string> v;
    vector<string> ans;
    for(int i = 0; i <= str.size(); i++){
        if(str[i] == ' '){
            v.push_back(str.substr(begin, i - begin));
            begin = i + 1;
        }
    }
    v.push_back(str.substr(begin, str.size() - begin));
    for(int i = 0; i < v.size(); i++){
        if((v[i][v[i].size() - 1] == ',' ||v[i][v[i].size() - 1] == '.') && v[i].size() >= 4 && v[i].size() <= 7 ){
          v[i][v[i].size() - 1] = ' ';
            ans.push_back(v[i]);
        }else if(v[i].size() >= 3 && v[i].size() <= 6){
            v[i] = v[i] + ' ';
            ans.push_back(v[i]);
    }
    }
    for(int i = 0; i < ans.size(); i++){
        cout << ans[i];
    }
        return 0;
}