#include<iostream>
#include<vector>
#include<string>

using namespace std;

char returnc(char c){
  if('a'<=c && c<='z'){
    if(c=='z')return 'a';
    return ++c;
  }
  return c;
}
int main(void){
  string s;
  getline(cin,s);
  string ss;
  vector<string> str;
  for(int i = 0 ; i < s.size() ; i ++){
    if(s[i] == ' ' || s[i] == ','|| s[i] == '.'){
      if(3<=ss.size() && ss.size() <= 6){
      str.push_back(ss);
      }
      ss="";
    }else{
      ss+= s[i];
    }
  }
  for(int i = 0 ; i < str.size()-1 ; i ++){
    cout<<str[i]<<" ";
  }
  cout<<str[str.size()-1]<<endl;
}