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

int main(){
  string s, t, r, v;
  bool flag=false;
  getline(cin, s);
  stringstream ss(s);
  while(getline(ss, t, ' ')){
    stringstream st(t);
    while(getline(st, r, ',')){
      stringstream sr(r);
      while(getline(sr, v, '.')){
        if(3<=v.length() && v.length()<=6){
          if(flag)cout<<' ';
          cout<<v;
          flag=true;
        }
      }
    }
  }
  cout<<endl;
  return 0;
}