#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;

int main(){
  char str[1200];
  int pos = 0;
  vector<string> ans;

  fgets(str,1200,stdin);

  while(1){
    string word;
    while(str[pos] != '.' && str[pos] != ' ' && str[pos] != ',' && str[pos] != '\n')word.push_back(str[pos++]);
    
    if(str[pos] == '\n')break;
    
    if( 2<(int)word.size() && (int)word.size()<7)ans.push_back(word);
    pos++;
  }
    
  for(int i=0;i<(int)ans.size()-1;i++){
    cout << ans[i] << " ";
  }
  if((int)ans.size())cout << ans[(int)ans.size()-1] << endl;
}