#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
using namespace std;

int n;
char buf[100000];
vector<string> ans;

int main() {
  fgets(buf, sizeof(buf), stdin);
  char *p = strchr(buf, '\n');
  if (p) *p = '\0';

  n = strlen(buf);
  string word;
  for (int i=0; i<n; i++) {
    char c = buf[i];
    if (c == ' ' || c == ',' || c == '.') {
      if (3 <= word.size() && word.size() <= 6) {
        ans.push_back(word);
      }
      word = "";
    } else word += c;
  }

  if (3 <= word.size() && word.size() <= 6) {
    ans.push_back(word);
  }

  
  if (!ans.empty()) {
    printf("%s", ans[0].c_str());
    for (int i=1; i<ans.size(); i++) {
      printf(" %s", ans[i].c_str());
    }
  }
  puts("");
}