#include <iostream>
#include <cstring>
using namespace std;

int main() {
  int k=0;
  char delims[] = ",. ";
  char ch[1024], *words[100];
  cin.getline(ch,1024);
  char *result;
  result = strtok(ch,delims);
  while(result != NULL ) {
      words[k] = result;
    if((strlen(words[k]) >= 3) && (strlen(words[k]) <= 6)) {
      k++;
    }
    result = strtok(NULL,delims);
  }
  for(int i=0;i<k-1;i++) {
    cout << words[i] << " ";
  }
  cout << words[k-1] << endl;
}