#include<stdio.h>
#include<string.h>
int inverte (char *n, int y, int aux) {
if (y <= aux) return 1;
else {
if (n[y - 1] != n[aux]) return 0;
return inverte(n, y-1, aux+1);
}
}
int palindromo (char *n) {
int aux1, x = 0;
aux1
= inverte
(n
, strlen(n
), 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;
}
I2luY2x1ZGU8c3RkaW8uaD4KI2luY2x1ZGU8c3RyaW5nLmg+CgoKaW50IGludmVydGUgKGNoYXIgKm4sIGludCB5LCBpbnQgYXV4KSB7CiAgICBpZiAoeSA8PSBhdXgpIHJldHVybiAxOwogICAgZWxzZSB7CiAgICAgICAgaWYgKG5beSAtIDFdICE9IG5bYXV4XSkgcmV0dXJuIDA7CgogICAgICAgIHJldHVybiBpbnZlcnRlKG4sIHktMSwgYXV4KzEpOwogICAgfSAKfQoKIGludCBwYWxpbmRyb21vIChjaGFyICpuKSB7CiAgICBpbnQgYXV4MSwgeCA9IDA7CgogICAgYXV4MSA9IGludmVydGUobiwgc3RybGVuKG4pLCB4KTsKCiAgICBpZiAoYXV4MSA9PSAxKSBwcmludGYoIkVoIHBhbGluZHJvbW9cbiIpOwogICAgZWxzZSBwcmludGYoIk5hbyBlaCBwYWxpbmRyb21vXG4iKTsKCiB9CgoKIGludCBtYWluKCkgewogCXBhbGluZHJvbW8oImJhbmFuYSIpOwogICAgcGFsaW5kcm9tbygiYW5uYSIpOwogICAgcGFsaW5kcm9tbygiYW5hIik7CiAgICBwYWxpbmRyb21vKCJiYW5hbmFiIik7CiAgICBwYWxpbmRyb21vKCJhYSIpOwogICAgcGFsaW5kcm9tbygiYSIpOwoKICAgIHJldHVybiAwOyAKIH0=