#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main()
{
  string sen;
  vector<string> Row1;

  getline(cin,sen);

  int size1 = sen.size();
  int j = 0;
  string temp1;

  for(int i = 0;i < size1;++i){
    char n = sen[i]; 
    if(n == ' ' || n == '.'|| n == ','){
      if(j == 0){
        Row1.push_back(temp1);
        j = 1;
        temp1.clear();
      }
      else{
        temp1.clear();
      }
    }
    else{
      temp1 += sen[i];
      if (j == 1){
        j = 0;
      }
    }
  }
  
  int Size1 = Row1.size();
  for(int i = 0;i < Size1;++i){
    string e;
    e = Row1.at(i);
    int size2 = e.size();

    if(i == Size1 - 1){
      if(3 <= size2 && 6 >= size2){
        cout<<e<<endl;
      }
    }
    else{
      if(3 <= size2 && 6 >= size2){
        cout<<e<<' ';
      }
    }
  }

  return 0;
}
