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

#define MAX 1024

using namespace std;

vector<string> EnumerateTerms(string &s, unsigned int min_len, unsigned int max_len){
	string term;
	vector<string> terms;
	for(unsigned int i = 0; i < s.length(); i++){
		if( s[i] == '.' || s[i] == ' ' || s[i] == ',' ){
			if( min_len <= term.length() && term.length() <= max_len ) terms.push_back(term);
			term.clear();
		}else term+=s[i];
	}
	return terms;
}

int main(void){
	char buf[MAX];
	string s;
	vector<string> terms;

	cin.getline(buf,sizeof(buf)/sizeof(*buf));
	s = buf;

	terms = EnumerateTerms(s, 3, 6);

	if( terms.size() > 0 ){
		cout << terms[0];
		for(unsigned int i = 1; i < terms.size(); i++){
			cout << ' ' << terms[i];
		}
	}
	cout << endl;
	return 0;
}