x=require('fs').readFileSync('/dev/stdin','utf8').trim().split(/\s/);

str2=[];
str="";
for(i=0;i<x.length;i++){
    if(x[i].length>=4&&x[i].length<=8){
        str += (x[i].replace(""," ").replace(","," ").replace(".",""));
    }
    if(x[i].replace(".","").length<x[i].length){
        str2.push(str);
        str="";
        
    }
    
}
console.log(str);

for(i=0;i<str2.length;){
    console.log(str2[i++]);
}