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

using namespace std;

int main()
{
  string sen1,sen2;
  string nl(" ");
  vector<string> Row1;

  while(cin>>sen1){
    sen2 += sen1;

    int s = sen2.size() - 1;
    if(sen2[s] == '.'){
      //break;
    }
    else{
      sen2 += nl;
    }
  }

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

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

    if(3 <= size2 && 6 >= size2){
      cout<<e<<endl;
    }
  }

  return 0;
}
