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

using namespace std;

vector<string> split(string&);
bool space(char);
bool not_space(char);

int main(){
  string line;
  vector<string> str, Search;

  getline(cin, line);
  str = split(line);

  for(vector<string>::size_type i=0; i != str.size(); ++i){
    if(str[i].size() > 2 && str[i].size() < 7)
      Search.push_back(str[i]);
  }

  for(vector<string>::size_type i=0; i != Search.size()-1; ++i){
    cout << Search[i] << " ";
  }
  cout << Search[Search.size()-1] << endl;

  return 0;
}

vector<string> split(string& str){
  string s;
  vector<string> Str;
  string::iterator i, j;

  j = str.begin();
  while(i != str.end() && j != str.end()){
    i = find_if(j, str.end(), not_space);
    j = find_if(i, str.end(), space);
    copy(i, j, back_inserter(s));

    if(s[s.size()-1] == ',' || s[s.size()-1] == '.')
      s = s.substr(0, s.size()-1);

    Str.push_back(s);
    s.clear();
  }

  return Str;
}

bool space(char c){
  return (isspace(c));
}

bool not_space(char c){
  return (!isspace(c));
}