#include <iostream>
#include <sstream>
void PrintPalindromeWords(std::string str) {
std::istringstream ss(str);
std::string word;
while (ss >> word) {
std::string rev_word(word.rbegin(), word.rend());
if (word == rev_word && word.size() >= 3)
std::cout << word << "\n";
}
}
int main()
{
std::string str = "c madam c++ civic java pytyp dart";
PrintPalindromeWords(str);
}
/*
run:
madam
civic
pytyp
*/