#include<stdio.h>
#include<string.h>
int inverte (char *n, int y, int aux) {
if (y <= aux) return 1;
else {
if (n[y] != n[aux]) return 0;
return inverte(n, y-1, aux+1);
}
}
int palindromo (char *n) {
int aux1, x = 0;
aux1
= inverte
(n
, strlen(n
) - 1, x
);
if (aux1
== 1) printf("Eh palindromo\n"); else printf("Nao eh palindromo\n");
}
int main() {
palindromo("banana");
palindromo("anna");
palindromo("ana");
palindromo("bananab");
palindromo("aa");
palindromo("a");
return 0;
}
ICAgICNpbmNsdWRlPHN0ZGlvLmg+CiAgICAjaW5jbHVkZTxzdHJpbmcuaD4KICAgICAKICAgICAKICAgIGludCBpbnZlcnRlIChjaGFyICpuLCBpbnQgeSwgaW50IGF1eCkgewogICAgICAgIGlmICh5IDw9IGF1eCkgcmV0dXJuIDE7CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIGlmIChuW3ldICE9IG5bYXV4XSkgcmV0dXJuIDA7CiAgICAgCiAgICAgICAgICAgIHJldHVybiBpbnZlcnRlKG4sIHktMSwgYXV4KzEpOwogICAgICAgIH0gCiAgICB9CiAgICAgCiAgICAgaW50IHBhbGluZHJvbW8gKGNoYXIgKm4pIHsKICAgICAgICBpbnQgYXV4MSwgeCA9IDA7CiAgICAgCiAgICAgICAgYXV4MSA9IGludmVydGUobiwgc3RybGVuKG4pIC0gMSwgeCk7CiAgICAgCiAgICAgICAgaWYgKGF1eDEgPT0gMSkgcHJpbnRmKCJFaCBwYWxpbmRyb21vXG4iKTsKICAgICAgICBlbHNlIHByaW50ZigiTmFvIGVoIHBhbGluZHJvbW9cbiIpOwogICAgIAogICAgIH0KICAgICAKICAgICAKICAgICBpbnQgbWFpbigpIHsKICAgICAJcGFsaW5kcm9tbygiYmFuYW5hIik7CiAgICAgICAgcGFsaW5kcm9tbygiYW5uYSIpOwogICAgICAgIHBhbGluZHJvbW8oImFuYSIpOwogICAgICAgIHBhbGluZHJvbW8oImJhbmFuYWIiKTsKICAgICAgICBwYWxpbmRyb21vKCJhYSIpOwogICAgICAgIHBhbGluZHJvbW8oImEiKTsKICAgICAKICAgICAgICByZXR1cm4gMDsgCiAgICAgfQ==