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

int main(){

  int len, w, cnt;
  string str, word;

  getline(cin, str);

  cnt = 0;
  len = str.length();
  for(int i=0; i<=len; i++){
    if(i == len || str[i] == ' ' || str[i] == '.' || str[i] == ','){
      w = word.length();
//cout << word << endl;
      if(w > 2 && w < 7){
        cnt++;
        if(cnt != 1) cout << " " << word;
        else cout << word;
      }
      word = "";
    }
    else word += str[i];
  }

  cout << endl;

  return 0;

}