#include<iostream>

using namespace std;

int main(){
  string in;
  getline(cin,in);
  in += "\n";
  string out = "";
  int status = 0;
  for(int i = 0; i < in.length(); i++){
    if(in[i] == ' ' || in[i] == '.' || in[i] == ',' || in[i] == '\n'){
      if(out.length() >= 3 && out.length() <= 6){
	if(status) cout << " ";
	cout << out;
	status = 1;
      }
      out = "";
    }else out += in[i];
  }
  cout << endl;
  return 0;
}