#include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    char inp;
    bool space = false;
    int i = 0;
    vector<char> outp;
    vector<char>::iterator it;
    while(scanf("%c",&inp) != EOF){
        if(inp == ' ' || inp == '.' || inp == ',' || inp == '\n' || inp == '\0'){
            if(outp.size() > 2 && outp.size() < 7 && outp.size() != 0){
                if(i != 0) cout << ' ';
                for(it = outp.begin(); it != outp.end(); it++){
                    cout << *it;
                }
                i++;
            }
            outp.clear();
        }else{
            outp.push_back(inp);
        }
    }
    cout << endl;
}