#include<iostream>
#include<cstdio>
#include<sstream>
#include<string>
using namespace std;
int main(){
  string s;
  string smap[10000];
  
  getline(cin,s);

  stringstream ss(s);
  int Index=0;
  while(ss >> s){
    smap[Index] = s;
    Index++;
  }
  int cou=0;
  for(int i=0;i<Index;i++){
    if( smap[i].find(",") != string::npos || smap[i].find(".") != string::npos && 2 < smap[i].length()-1 && smap[i].length()-1 < 7){
      cout << smap[i].substr(0,smap[i].length()-1);
      if(i != Index-1)cout << " ";
      cou++;
    }
    else if( smap[i].find(",") == string::npos && smap[i].find(".") == string::npos   && 2 < smap[i].length() && smap[i].length() < 7)
      {
	cou++;
	cout << smap[i];
	if(i != Index-1)cout << " ";
      }
  
  }
  if(cou != 0)cout << endl;


  return 0;
}