#include <string>
#include <cctype>
#include <algorithm>
#include <iostream>
bool is_palindrome( const std::string& str )
{
std::string s ;
for( char c : str ) if( std::isalpha(c) ) s += std::toupper(c) ;
return !s.empty() && std::equal( s.begin(), s.begin() + s.size()/2, s.rbegin() ) ;
}
int main()
{
const char* const phrases[]
{
"A man, a plan, a canal - Panama!", // yes
"not palindrome", // no
"No lemon, no melon", // yes
"Not lemon, not melon", // almost, but no
"Never odd or even" // yes
};
for( auto cstr : phrases ) if( is_palindrome(cstr) ) std::cout << cstr << '\n' ;
}
I2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPGNjdHlwZT4KI2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGlvc3RyZWFtPgoKYm9vbCBpc19wYWxpbmRyb21lKCBjb25zdCBzdGQ6OnN0cmluZyYgc3RyICkKewogICAgc3RkOjpzdHJpbmcgcyA7CiAgICBmb3IoIGNoYXIgYyA6IHN0ciApIGlmKCBzdGQ6OmlzYWxwaGEoYykgKSBzICs9IHN0ZDo6dG91cHBlcihjKSA7CiAgICByZXR1cm4gIXMuZW1wdHkoKSAmJiBzdGQ6OmVxdWFsKCBzLmJlZ2luKCksIHMuYmVnaW4oKSArIHMuc2l6ZSgpLzIsIHMucmJlZ2luKCkgKSA7Cn0KCmludCBtYWluKCkKewogICAgY29uc3QgY2hhciogY29uc3QgcGhyYXNlc1tdCiAgICB7CiAgICAgICAgIkEgbWFuLCBhIHBsYW4sIGEgY2FuYWwgLSBQYW5hbWEhIiwgLy8geWVzCiAgICAgICAgIm5vdCBwYWxpbmRyb21lIiwgLy8gbm8KICAgICAgICAiTm8gbGVtb24sIG5vIG1lbG9uIiwgLy8geWVzCiAgICAgICAgIk5vdCBsZW1vbiwgbm90IG1lbG9uIiwgLy8gYWxtb3N0LCBidXQgbm8KICAgICAgICAiTmV2ZXIgb2RkIG9yIGV2ZW4iIC8vIHllcwogICAgfTsKICAgIGZvciggYXV0byBjc3RyIDogcGhyYXNlcyApIGlmKCBpc19wYWxpbmRyb21lKGNzdHIpICkgc3RkOjpjb3V0IDw8IGNzdHIgPDwgJ1xuJyA7Cn0K