#include <iostream>
#include <vector>
#include <string>
using namespace std;

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

  vector<string> vs;
  string word = "";
  for(int i = 0; i < str.size(); i++) {
    char c = str[i];
    if(c == ' ' || c == ',' || c == '.' || i+1 == str.size()) {
      if(3 <= word.size() && word.size() <= 6) vs.push_back(word);
      word = "";
    } else {
      word += c;
    }
  }

  cout << vs[0];
  for(int i = 1; i < vs.size(); i++) {
    cout << " " << vs[i];
  }
  cout << endl;
}