
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
using namespace std ;
typedef vector<int> vi ;
typedef vector<vi> vvi ;
typedef vector<string> vs ;
typedef pair<int, int> pii; 
typedef long long ll ;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()


int main(void){
  string buf;
  vector<string> ans;
  getline(cin,buf);
  string str="";
  rep(i,buf.size()){
    if(buf[i] == ',' || buf[i] == '.' || buf[i] == ' '){
      if(3 <= str.size() && str.size() <= 6)
	ans.push_back(str);
      str = "";
      continue;
    }
    str+=buf[i];
  }
  rep(i,ans.size())
    cout << ans[i] << " ";
  cout<<endl;
}