#include<bits/stdc++.h>

using namespace std;

int main(){

  string search;
  string word;
  vector<string> result(1024);
  int num=0;
  
  getline(cin,search);

  for(int i=0;i<search.size();++i){
   
	if(search[i]==' ' || search[i]== ',' || search[i]=='.'){
	  if(word.size() >= 3 && word.size() <= 6){
		result[num] = word;
		num++;
	  }
	  word.clear();
	}

	else
	  word.push_back(search[i]);
	
  }

  for(int i=0;i<num;++i){
	cout<<result[i];
	if(i != num-1)
	  cout<<' ';
  }
  
  cout<<endl;
  
}
