#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cctype>
using namespace std;

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

char buf[1030];

inline bool ok(char c) {
  return c != ',' && c != ' ' && c != '.' ;
}

int main() {
  while (gets(buf)) {
    const int N = strlen(buf);
    size_t itr = 0, cnt = 0;
    if (ok(buf[0])) {
      cnt = 1;
    } else {
      itr = 1;
    }
    for (int i = 1; i < N; ++i) {
      if (ok(buf[i])) {
        ++cnt;
      } else {
        if (cnt > 2 && cnt < 7) {
          for (int j = itr; j < i; ++j) putchar(buf[j]);
        }
        itr = i;
        cnt = 0;
      }
    }
    puts("");
  }
  return 0;
}