#include<iostream>
using namespace std;

string str,out;

int flg=0;

int main(){
  getline(cin,str);
  out="";
  for(int i=0;i<(int)str.size();i++){
    if((str[i]==' '||str[i]=='.'||str[i]==',')){
      if(out.size()>=3&&out.size()<=6){
	if(flg)cout<<" ";
	cout<<out;
	flg=1;
      }
      out="";
    }else{
      out.push_back(str[i]);
    }    
  }
  cout<<endl;

  return 0;
}