#include <iostream>
#include <string>

int main()
{
	std::string buf;
	getline(std::cin, buf);
	
	int offset = 0;
	bool lastword = false;
	bool first_output = true;
	while (!lastword) {
		int pos = buf.find(' ', offset);
		std::string tmp;
		if (pos==std::string::npos) {
			tmp = buf.substr(offset);
			lastword = true;
		} else {
			tmp = buf.substr(offset, pos-offset);
		}
		char last_char = tmp[tmp.size()-1];
		if (last_char == ',' || last_char == '.') {
			tmp.erase(tmp.size()-1);
		}
		if ( 3 <= tmp.size() && tmp.size() <= 6 ) {
			if (first_output) { std::cout << tmp; first_output = false; }
			else std::cout << " " << tmp;
		}
		offset = pos + 1;
	}
	std::cout << std::endl;
	
	return 0;
}
