#include <iostream>
#include <string>
bool is_palidrome(std::string inputString) {
auto num_to_parse = inputString.size();
auto middleOfString = num_to_parse / 2;
for (decltype(num_to_parse) i = 0; i < middleOfString; ++i) {
if (inputString[i] != inputString[num_to_parse-i-1]) {
return false;
}
}
return true;
}
int main() {
// Change the value of inputString to test different palindromes
std::string inputString = "caabaac";
if (is_palidrome(inputString)) {
std::cout << "This is a palindrome." << std::endl;
} else {
std::cout << "Not a palindrome." << std::endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgogCmJvb2wgaXNfcGFsaWRyb21lKHN0ZDo6c3RyaW5nIGlucHV0U3RyaW5nKSB7CiAgICBhdXRvIG51bV90b19wYXJzZSA9IGlucHV0U3RyaW5nLnNpemUoKTsKICAgIGF1dG8gbWlkZGxlT2ZTdHJpbmcgPSBudW1fdG9fcGFyc2UgLyAyOwogICAgICAgIAogICAgZm9yIChkZWNsdHlwZShudW1fdG9fcGFyc2UpIGkgPSAwOyBpIDwgbWlkZGxlT2ZTdHJpbmc7ICsraSkgewogICAgICAgIGlmIChpbnB1dFN0cmluZ1tpXSAhPSBpbnB1dFN0cmluZ1tudW1fdG9fcGFyc2UtaS0xXSkgewogICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfQogICAgfQoKICAgIHJldHVybiB0cnVlOwp9CiAKIAppbnQgbWFpbigpIHsKICAgIC8vIENoYW5nZSB0aGUgdmFsdWUgb2YgaW5wdXRTdHJpbmcgdG8gdGVzdCBkaWZmZXJlbnQgcGFsaW5kcm9tZXMKICAgIHN0ZDo6c3RyaW5nIGlucHV0U3RyaW5nID0gImNhYWJhYWMiOwogCiAgICBpZiAoaXNfcGFsaWRyb21lKGlucHV0U3RyaW5nKSkgewogICAgICAgIHN0ZDo6Y291dCA8PCAiVGhpcyBpcyBhIHBhbGluZHJvbWUuIiA8PCBzdGQ6OmVuZGw7CiAgICB9IGVsc2UgewogICAgICAgIHN0ZDo6Y291dCA8PCAiTm90IGEgcGFsaW5kcm9tZS4iIDw8IHN0ZDo6ZW5kbDsKICAgIH0KIAogICAgcmV0dXJuIDA7Cn0=