#include<bits/stdc++.h>
using namespace std;

vector< string > split(string str, string del){
  char *p, *str_buff = new char[str.size() + 1], first = 0;
  vector< string > ret;
  strcpy( str_buff, str.c_str());
  while(p = strtok((first++ ? NULL : str_buff), del.c_str())){
    ret.push_back(p);
  }
  delete str_buff;
  return ret;
}

int main(){
  string s;
  getline( cin, s);
  vector< string > ans = split( s, " ,.");
  vector< string > ret;
  for(int i = 0; i < ans.size(); i++){
    if(ans[i].size() >= 3 && ans[i].size() <= 6) ret.push_back(ans[i]);
  }
  for(int i = 0; i < ret.size(); i++){
    cout << ret[i] << " \n"[i == ret.size() - 1];
 }
}