#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
using namespace std;
int main(){
	string str;
	getline(cin,str);
	str += " ";
    vector<string> word;
    int j = 0;
    for(int i = 0; i < str.size(); i++){
        if(str[i] == ' ' || str[i] == ',' || str[i] == '.'){
            if(3 <= i-j && i-j <= 6){
                word.push_back(str.substr(j,i-j));
            }
            j = i + 1;
        }
    }
    for(int i = 0; i < word.size(); i++){
        cout << word[i];
        printf("%c",i==word.size()-1?'\n':' ');
    }
	return 0;
}