#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define INF 1000000001
#define MOD 10000
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const ull B=100000007;
int main(){
      string s,t="";
      vector<string> ans;
      getline(cin,s);
      REP(i,s.size()){
            if(s[i]==' '||s[i]==','||s[i]=='.'){
                  if(3<=t.size()&&t.size()<=6)ans.PB(t);
                  t="";
            }else t+=s[i];
      }
      REP(i,ans.size()){
            cout<<ans[i];
            if(i==ans.size()-1)cout<<endl;
            else cout<<" ";
      }
}