#include<bits/stdc++.h>

using namespace std;

int main(){

  string search;
  string result;
  
  getline(cin,search);

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

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

  cout<<endl;
  
}

