#include<iostream>
#include<cstdio>
#include<sstream>
#include<string>
using namespace std;



int main(){
  string s;
  getline(cin,s);
  for(int i=0;i<s.length();i++)if(s[i] == ',' || s[i] == '.')s[i] = ' ';
  stringstream ss;
  string ans[1024];
  ss << s;
  int cnt = 0;
  while(cnt < (ss.str()).size())
    ss >> ans[cnt++];

  string rans = "";
  
  for(int i=0;i<cnt;i++){
    if(!(ans[i].size() >= 3 && ans[i].size() <= 6))continue;
    if(i != 0)rans += " ";
    rans += ans[i];
  }
  cout << rans << endl;
 
  return 0;
}