#include <stdio.h>
#include <string.h>
// Função recursiva para verificar se a palavra é palíndromo
int palindromo(char palavra[], int tam, int posicao) {
if (posicao < tam / 2){
if (palavra[posicao] == palavra[tam - posicao - 1]){
return 1 * palindromo(palavra, tam, posicao+1);
}
else{
return 0;
}
}
else{
return 1;
}
}
int main() {
char palavra[255];
int tam;
printf ("Digite a palavra: \n"); gets(palavra
); // Ler a palavra digitada pelo usuário
tam
= strlen(palavra
); // Tamanho da palavra
if (palindromo(palavra, tam, 0))
else
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KCi8vIEZ1bsOnw6NvIHJlY3Vyc2l2YSBwYXJhIHZlcmlmaWNhciBzZSBhIHBhbGF2cmEgw6kgcGFsw61uZHJvbW8KaW50IHBhbGluZHJvbW8oY2hhciBwYWxhdnJhW10sIGludCB0YW0sIGludCBwb3NpY2FvKSB7CiAgIAogICAgaWYgKHBvc2ljYW8gPCB0YW0gLyAyKXsKICAgICAgICBpZiAocGFsYXZyYVtwb3NpY2FvXSA9PSBwYWxhdnJhW3RhbSAtIHBvc2ljYW8gLSAxXSl7CgkJCXJldHVybiAxICogcGFsaW5kcm9tbyhwYWxhdnJhLCB0YW0sIHBvc2ljYW8rMSk7CgkJfQogICAgICAgIGVsc2V7CgkJCXJldHVybiAwOwoJCX0KCX0KICAgIGVsc2V7CgkJcmV0dXJuIDE7Cgl9Cn0KCmludCBtYWluKCkgewoKICAgY2hhciBwYWxhdnJhWzI1NV07CiAgIGludCB0YW07CiAgICAgIAogICBwcmludGYgKCJEaWdpdGUgYSBwYWxhdnJhOiBcbiIpOyAgIAogICBnZXRzKHBhbGF2cmEpOyAvLyBMZXIgYSBwYWxhdnJhIGRpZ2l0YWRhIHBlbG8gdXN1w6FyaW8KICAgCiAgIHRhbSA9IHN0cmxlbihwYWxhdnJhKTsgLy8gVGFtYW5obyBkYSBwYWxhdnJhCiAgIAogICBpZiAocGFsaW5kcm9tbyhwYWxhdnJhLCB0YW0sIDApKQogICAgICBwcmludGYoIsOJIHBhbMOtbmRyb21vXG4iKTsKICAgZWxzZQogICAgICBwcmludGYoIk7Do28gw6kgcGFsw61uZHJvbW9cbiIpOwoJICAKICAgcmV0dXJuIDA7Cn0K