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

using namespace std;

int main() {
  string s;
  vector<string> str;
  while (cin >> s) {
    if (s[s.size() - 1] == '.' || s[s.size() - 1] == ',') {
      s.erase(s.size() - 1);
    }
    if (3 <= s.size() && s.size() <= 6) {
      str.push_back(s);
    }
  }
  for (vector<string>::iterator it = str.begin(); it != str.end(); ++it) {
    if (it == str.end() - 1) cout << *it << endl;
    else cout << *it << ' ';
  }
}