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

int main(void) {
  string s, s1;
  int start;
  int flag;
  char c = '\0';
  getline(cin, s);
  flag = 1;
  for(int i = 0; i < s.length(); i++) {
    if(s[i] == ' ' || s[i] == ',' || s[i] == '.') {
      if(!flag) {
        s1 = s.substr(start, i-start);
	if(s1.length() >= 3 && s1.length() <= 6) {
	  cout << c << s1;
	  c = ' ';
	}
      }
      flag = 1;
    } else {
      if(flag) {
	start = i;
      }
      flag = 0;
    }
    if(i == s.length()-1 && !flag) {
      s1 = s.substr(start, i-start);
      if(s1.length() >= 3 && s1.length() <= 6) {
	cout << c << s1;
	c = ' ';
      }
    }
  }
  cout << endl;
  return 0;
}