#include <iostream>
#include <string>
bool palindrome( const std:: string & str ) ;
int main( )
{
std:: string input;
while ( std:: getline ( std:: cin , input ) )
{
if ( palindrome( input ) )
std:: cout << input << " is a palindrome." << std:: endl ;
else
std:: cout << input << " is NOT a palindrome." << std:: endl ;
}
return 0 ;
}
bool palindrome( const std:: string & str )
{
bool isPalindrome = true ;
std:: string :: const_iterator left = str.cbegin ( ) , right = str.cend ( ) - 1 ;
for ( ; left < right && isPalindrome; ++ left , -- right )
{
if ( * left ! = * right )
isPalindrome = false ;
}
return isPalindrome;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgoKYm9vbCBwYWxpbmRyb21lKCBjb25zdCBzdGQ6OnN0cmluZyAmc3RyICk7CgppbnQgbWFpbigpCnsKCXN0ZDo6c3RyaW5nIGlucHV0OwoJCgl3aGlsZSggc3RkOjpnZXRsaW5lKCBzdGQ6OmNpbiAsIGlucHV0ICkgKQoJewoJCWlmKCBwYWxpbmRyb21lKCBpbnB1dCApICkKCQkJc3RkOjpjb3V0IDw8IGlucHV0IDw8ICIgaXMgYSBwYWxpbmRyb21lLiIgPDwgc3RkOjplbmRsOwoJCWVsc2UKCQkJc3RkOjpjb3V0IDw8IGlucHV0IDw8ICIgaXMgTk9UIGEgcGFsaW5kcm9tZS4iIDw8IHN0ZDo6ZW5kbDsKCX0KCXJldHVybiAwOwp9Cgpib29sIHBhbGluZHJvbWUoIGNvbnN0IHN0ZDo6c3RyaW5nICZzdHIgKQp7Cglib29sIGlzUGFsaW5kcm9tZSA9IHRydWU7CglzdGQ6OnN0cmluZzo6Y29uc3RfaXRlcmF0b3IgbGVmdCA9IHN0ci5jYmVnaW4oKSAsIHJpZ2h0ID0gc3RyLmNlbmQoKS0xOwoJCglmb3IoIDsgbGVmdCA8IHJpZ2h0ICYmIGlzUGFsaW5kcm9tZTsgKytsZWZ0ICwgLS1yaWdodCApCgl7CgkJaWYoICpsZWZ0ICE9ICpyaWdodCApCgkJCWlzUGFsaW5kcm9tZSA9IGZhbHNlOwoJfQoJcmV0dXJuIGlzUGFsaW5kcm9tZTsKfQ==