#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;

int main(){
  char str[1200];
 
  while(fgets(str,1200,stdin)!=NULL){
    int pos = 0;
    vector<string> ans;

    while(1){
      string word;
      while(str[pos] != '.' && str[pos] != ' ' && str[pos] != ',' && str[pos] != '\n')word.push_back(str[pos++]);
      
      if(str[pos] == '\n')break;
      
      if( 2<(int)word.size() && (int)word.size()<7){
	/*
	bool f = true;
	for(int i=0;i<(int)word.size();i++){
	  if( (word[i] < 'a' || word[i] > 'z') && (word[i] < 'A' && word[i] > 'Z') ){
	    f = false;
	    break;
	    }
	  }
	*/
	/*if(f)*/ans.push_back(word);
	
      }
     
      pos++;
    }
    
    for(int i=0;i<(int)ans.size()-1;i++){
      cout << ans[i] << " ";
    }
    if((int)ans.size())cout << ans[(int)ans.size()-1] << endl;
    
  }
}