#include <iostream>
#include <stack>
using namespace std;
int main() {
stack<char> stack;
cout << "Enter a string (max 10 letters): ";
char string[10];
cin.getline(string, 10);
int size = cin.gcount();
for (int t = 0; t < (size >> 1); ++t)
stack.push(string[t]);
for (int t = ~size & 1 ? size >> 1 : -~(size >> 1); t < size; ++t) {
char top = stack.top();
stack.pop();
if (top != string[t]) {
cout << "The string is not palindrome\n";
break;
}
}
if (stack.empty())
cout << "The string is palindrome\n";
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RhY2s+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCXN0YWNrPGNoYXI+IHN0YWNrOwoJY291dCA8PCAiRW50ZXIgYSBzdHJpbmcgKG1heCAxMCBsZXR0ZXJzKTogIjsKCWNoYXIgc3RyaW5nWzEwXTsKCWNpbi5nZXRsaW5lKHN0cmluZywgMTApOwoJaW50IHNpemUgPSBjaW4uZ2NvdW50KCk7CgkKCWZvciAoaW50IHQgPSAwOyB0IDwgKHNpemUgPj4gMSk7ICsrdCkKCQlzdGFjay5wdXNoKHN0cmluZ1t0XSk7CgkJCglmb3IgKGludCB0ID0gfnNpemUgJiAxID8gc2l6ZSA+PiAxIDogLX4oc2l6ZSA+PiAxKTsgdCA8IHNpemU7ICsrdCkgewoJCWNoYXIgdG9wID0gc3RhY2sudG9wKCk7CgkJc3RhY2sucG9wKCk7CgkJaWYgKHRvcCAhPSBzdHJpbmdbdF0pIHsKCQkJY291dCA8PCAiVGhlIHN0cmluZyBpcyBub3QgcGFsaW5kcm9tZVxuIjsKCQkJYnJlYWs7CgkJfQoJfQoJCglpZiAoc3RhY2suZW1wdHkoKSkKCQljb3V0IDw8ICJUaGUgc3RyaW5nIGlzIHBhbGluZHJvbWVcbiI7CglyZXR1cm4gMDsKfQ==