#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
  string str, tmp="";
  string ans[1025];
  int cnt=0;
  getline(cin, str);
  
  for(int i = 0 ; i < str.size() ; i++){
    if(str[i] == ' ' || str[i] == ',' || str[i] == '.'){
      if(3 <= tmp.size() && tmp.size() <= 6){
	ans[cnt] = tmp;
	cnt++;
	tmp = "";
      }
    }
    if(str[i] == ' ' || str[i] == ',' || str[i] == '.') tmp = "";
    else tmp += str[i];
  }
  for(int i = 0 ; i < cnt ; i++){
    if(i == cnt-1) cout << ans[i] << endl;
    else cout << ans[i] << ' ';
  }
  return 0;
}