#include<iostream>
#include<string>
using namespace std;

int main(){

  string s;
  string ans[1000];
  int n = -1;
  int r,k = 0;

  getline(cin,s);

  for(int i=0;i<s.size();i++){

    if(s[i] == ' ' || s[i] == ',' || s[i] == '.'){
      if(i-1-n > 2 && i-1-n < 7){

	for(int j=n+1;j<i;j++) ans[k] += s[j];

	k++;
	n = i;
      }

      else n = i;

    }
  }

  cout << ans[0];
  for(int i=1;i<k;i++) cout << " " << ans[i];
  cout << endl;

}