#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
using namespace std;

int main() {
  string s;
  while(getline(cin, s)) {
    replace(s.begin(), s.end(), '.', ' ');
    replace(s.begin(), s.end(), ',', ' ');
    stringstream ss(s);
    bool first = true;
    while(ss >> s) {
      if(s.size() >= 3 && s.size() <= 6) {
        if(first) first = false;
        else cout << " ";
        cout << s;
      }
    }
    cout << endl;
  }
  return 0;
}