#include <iostream>
#include <string>


std::string make(std::string str) {
	int i = 0;
	std::string res = "";
	while (i < str.size()) {
		if (!(str[i] == ',' || str[i] == '.')) {
			res += str[i];
		}

		i++;
	}

	return res;
}
void solve(std::string str) {
	int i = 0;
	std::string temp = "";

	while (i < str.size()) {
		if (str[i] == ' ') {
			if (3 <= temp.size() && temp.size() <= 6) {
				std::cout << temp << ' ';
			}
			temp = "";
		} else {
			temp += str[i];
		}

		i++;
	}
	if (3 <= temp.size() && temp.size() <= 6) {
		std::cout << temp << std::endl;
	}

}

int main() {
	std::string source;
	std::getline(std::cin, source);

	solve(make(source));

	return 0;
}