#include <iostream>
#include <string>

using namespace std;
int main(){
  string str;
  while(getline(cin,str)){
    int cnt = 0;
    str+='\n';
    for(int i = 0 ; i < str.size() ; i++ ){
      if(str[i] == '\n'){
	cout << str.substr(i-cnt,cnt) << endl;
      }else if(str[i] == ',' || str[i] == '.' || str[i] == ' '){
	if(3<=cnt && cnt < 7){
	  cout << str.substr(i-cnt,cnt) <<" ";
	}
	cnt = 0;
      }else cnt++;
    }
  }
  return 0;
}