#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

int main() {
  string str;
  getline(cin, str);

  int pos = -1;
  while (pos = str.find(',', pos + 1), pos != string::npos)
    str.replace(pos, 1, " ");
  pos = -1;
  while (pos = str.find('.', pos + 1), pos != string::npos)
    str.replace(pos, 1, " ");

  stringstream ss(str);
  vector<string> ans;
  string tmp;
  while (ss >> tmp) {
    if (3 <= tmp.length() && tmp.length() <= 6)
      ans.push_back(tmp);
  }

  if (ans.size() != 0) {
    cout << ans[0];
    for (auto itr = ans.begin() + 1; itr != ans.end(); ++itr)
      cout << " " << *itr;
    cout << endl;
  }
}
