#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>

using namespace std;

int main() {

  char buf[1100];

  char word[1100];

  char* tp;
  int len;

  fgets(buf,sizeof(buf),stdin);

  buf[strlen(buf)-1]='\0';

  tp=strtok(buf,",. ");

  len=strlen(tp);

  if(len>=3 && len<=6) cout << tp;

  while(tp!=NULL) {

    tp=strtok(NULL,",. ");

    if(tp!=NULL) {
      
      len=strlen(tp);

      if(len>=3 && len<=6) cout << " " << tp;

    }

  }

  cout << endl;

  return 0;

}