#include <cstdio>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
char s[1111];
string ss;
int main(void){
  fgets(s,sizeof(s),stdin);
  ss = (string)s;
  int p = 0;
  int c = 0;
  string sss;
  string res;
  for(int i = 0; i < (int)ss.size(); i++,c++){
    if(ss[i] == ',' || ss[i] == '.' || ss[i] == ' '){
      sss = ss.substr(p,c);
      if(3 <= (int)sss.size() && (int)sss.size() <= 6){
	if((int)res.size()) res += ' ';
	res += sss;
      }
      p = i + 1;
      c = -1;
    }
  }
  cout << res << endl;
}