#include<iostream>
int main(){std::string l[1000];int c=0,k;while(std::cin>>l[c]){k=l[c].length();if((l[c].find(","))+(l[c].find("."))!=-2)l[c].replace(k-1,1,""),k-=1;if((k>2)&&(k<7))c++;}for(k=0;k<c-1;k++)std::cout<<l[k]<<" ";std::cout<<l[c-1]<<"\n";}