#include <iostream>
#include <stdio.h>
#include <math.h>
#include <iomanip>

using namespace std;

string s[1024];

int main(void)
{
    int c=0;
    string ret;
    while(cin>>s[c]){
        if(s[c][s[c].length()-1]==',' || s[c][s[c].length()-1]=='.')s[c].erase(s[c].length()-1);
            
            
            
            
            
            
            
            
            
        if(3<=s[c].length()&&s[c].length()<=6)ret+=s[c]+' ';
        c++;
    }
    ret.erase(ret.length()-1);
    cout<<ret<<endl;
    
}