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

int main(){
  string str,word[1024];
  string s[] = {",","."};
  getline(cin,str);
  stringstream ss(str);
  int cou = 0;
  while(!ss.eof()){
    ss >> word[cou];
    cou++;
  }
  bool flg = false;
  for(int i=0;i<cou;i++){
    for(int j=0;j<2;j++){
      int loc = word[i].find(s[j],0);
      if(loc != string::npos) word[i].erase(loc);
    }
    int len = word[i].size();
    if(len >= 3 && len <= 6){
      if(flg) cout << " ";
      flg = true;
      cout << word[i];
    }
  }
  cout << endl;
}