#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
  string s;
  getline(cin,s);
  char *p;
  char str[s.length()+1];
  strcpy(str,s.c_str());
  p = strtok(str," .,");
  int f=0;
  while(p!=NULL) {
    if (strlen(p)>=3&&strlen(p)<=6) {
      if (f) cout << " ";
      else f++;
      cout << p;
    }
    p = strtok(NULL, " .,");
  }
  cout << endl;
}