#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <bitset>
 
#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

int main(int argc, char **argv){
	std::string str;
	std::string word;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif

#if INPUT_FROM_FILE
	while(std::getline(ifs, str)){
#else
	while(std::getline(std::cin, str)){
#endif
		std::replace(str.begin(), str.end(), ',', ' ');
		std::replace(str.begin(), str.end(), '.', ' ');
		std::istringstream stream(str);
		std::vector<std::string> words;

		while(std::getline(stream, word, ' ')){
			if(word.size() >= 3 && word.size() <= 6){
				words.push_back(word);
			}
		}

		if(!words.empty()){
			std::cout << words[0];
		}
		for(int i = 1; i < words.size(); i++){
			std::cout << " " << words[i];
		}
		std::cout << std::endl;
	}


 
#if INPUT_FROM_FILE
	//fclose(fp);
#endif
    return 0;
}
