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


std::vector<std::string> split(std::string source, char ch) {
	std::vector<std::string> res;
	std::string temp = "";
	int i = 0;

	while (i < source.size()) {
		if (source[i] == ch) {
			res.push_back(temp);
			temp = "";
		} else {
			temp += source[i];
		}
		i++;
	}

	return res;
}


int main() {
	std::string source;
	std::getline(std::cin, source);
	std::replace(source.begin(), source.end(), ',', ' ');
	std::replace(source.begin(), source.end(), '.', ' ');
	
	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;
			} else {
				std::cout << " ";
			}
		}
	}

	return 0;
}