#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

vector<string> split(const string &s, const string& seps) {
  vector<string> res;
  int pos = 0, sz = seps.size();
  size_t find_pos = string::npos;
  while (true) {
    for (int i = 0; i < sz; i++) {
      size_t tmp = s.find(seps[i], pos);
      if (find_pos == string::npos || tmp < find_pos) find_pos = tmp;
    }
    if (find_pos == string::npos) break;
    res.emplace_back(s.substr(pos, find_pos - pos));
    pos = find_pos + 1;
    find_pos = string::npos;
  }
  if (pos < (int)s.size()) res.emplace_back(s.substr(pos));
  return res;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  string s;
  getline(cin, s);
  vector<string> a = split(s, " .,"), ans;
  for (auto &i : a) {
    int iz = i.size();
    if (iz >= 3 && iz <= 6) ans.emplace_back(i);
  }
  int ansz = ans.size();
  for (int i = 0; i < ansz; i++) {
    cout << ans[i] << " \n"[i + 1 == ansz];
  }

  return 0;
}
