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

int main() {

  string s;

  char c;

  string word;

  vector<string> ans;

  while( getline( cin, s ) ) {

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

      c = s[i];
      if ( c == ' ' || c == '.' || c == ',' ) {

	if ( word.size() >= 3 && word.size() <= 6 ) {
	  if ( count( ans.begin(), ans.end(), word ) == 0 ) {
	    ans.push_back( word );
	  }
	}
	word = "";

      }else {

	word += c;

      }

    }

    if ( word.size() >= 3 && word.size() <= 6 ) {
      if ( count( ans.begin(), ans.end(), word ) == 0 ) {
	ans.push_back( word );
      }
    }


  }

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

    if ( i != 0 ) cout << " ";
    cout << ans[i];

  }

  cout << endl;

  return 0;

}