#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
using namespace std;

int main()
{
    vector<string> words;
    char str[1030];
    scanf("%[^\n]", str);
    char* word = strtok(str, " .,");
    while(word != NULL){
        int length = strlen(word);
        if(2 < length && length < 7){
            words.push_back(string(word));
        }
        word = strtok(NULL, " .,");
    }
    
    for(int i = 0; i < words.size(); ++i){
        if(i) cout << ' ';
        cout << words[i];
    }
    cout << endl;
}