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

int main() {

  string s;

  char c;

  string word;

  while( getline( cin, s ) ) {

    bool flag = true;
    vector<string> ans;

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

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

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

      }else {

	word += c;

	if ( ( c < 'a' || c > 'z' ) && ( c < 'A' || c > 'Z' ) ) flag = false;

      }

    }

    if ( word.size() >= 3 && word.size() <= 6 && flag ) {
      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;

}