#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
bool f = false;
void output(string word){
  if(word[word.size()-1]==','||word[word.size()-1]=='.'){
    word = word.substr(0,word.size()-1);
  }
  if(3<=word.size()&&word.size()<=6){
    if(f){
      cout<<' ';
    }else{
      f = true;
    }
    cout<<word;
  }
}

int main(void){
  string sentence;
  stringstream ss;
  getline(cin,sentence);
  ss<<sentence;
  string part;
  while(ss>>part){
    int tmp=0;
    REP(i,part.size()){
      if(i==part.size()-1){
        output(part.substr(tmp));
      }else if(part[i]=='.'||part[i]==','){
        output(part.substr(tmp,i-tmp));
        tmp = i+1;
      }
    }
  }
  cout<<endl;
  return 0;
}