#include <bits/stdc++.h>
using namespace std;

vector<string> split(string s) {
  vector<string> res;
  string t = "";
  for (int r = 0; r < s.size(); ++r) {
    if (s[r] == ' ' || s[r] == ',' || s[r] == '.') {
      res.push_back(t);
      t = "";
    } else {
      t += s[r];
    }
  }

  return res;
}

vector<string> ex(string s) {
  vector<string> v = split(s), res;
  for (int i = 0; i < v.size(); ++i) {
    if (2 < v[i].size() && v[i].size() < 7) {
      res.push_back(v[i]);
    }
  }
  return res;
}

int main() {
  string s;

  getline(cin, s);

  vector<string> v = ex(s);
  for (int i = 0; i < v.size(); ++i) {
    cout << v[i] << (i + 1 == v.size() ? "\n" : " ");
  }
}