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


std::vector<std::string> split(std::string source) {
	std::vector<std::string> res;
	std::string temp = "";

	int i = 0;
	while (i < source.size()) {
		if (source[i] == '.' || source[i] == ',') {
			if (i + 1 < source.size()) {
				if (source[i + 1] != ' ') {
					temp += source[i];
				} else {
					res.push_back(temp);
					temp = "";
					i++;
				}
			}
		} else if (source[i] == ' ') {
			res.push_back(temp);
			temp = "";
		} else {
			temp += source[i];
		}
		i++;
	}
	res.push_back(temp);

	return res;
}


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

	std::vector<std::string> str = split(source);
	for (int i = 0; i < str.size(); i++) {
		if (3 <= str[i].size() && str[i].size() <= 6) {
			std::cout << str[i];
			if (i == str.size() - 1) {
				std::cout << std::endl;
				break;
			}
			std::cout << " ";
		}
	}

	return 0;
}