#include <iostream>
using namespace std;
int main(void)
{
string texto = "";
bool palindromo = true;
cout << "Digite a palavra : " ;
cin >> texto;
int tamanho = texto.length(); //retirei do loop
//reduzi a verificação pela metade, se chegar na metade e todas comparações são iguais é palíndromo
//o algoritmo compara a primeira metade com o inverso na segunda metade
for (int i = tamanho / 2; i > 0; i--)
{
if (texto[i] != texto[tamanho - i - 1])
{
palindromo = false;
break;
}
}
cout << endl << (palindromo ? "É palíndromo" : "não é palíndromo");
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4odm9pZCkKewogICAgc3RyaW5nIHRleHRvID0gIiI7CiAgICBib29sIHBhbGluZHJvbW8gPSB0cnVlOwoKICAgIGNvdXQgPDwgIkRpZ2l0ZSBhIHBhbGF2cmEgOiAiIDsKICAgIGNpbiA+PiB0ZXh0bzsKCiAgICBpbnQgdGFtYW5obyA9IHRleHRvLmxlbmd0aCgpOyAvL3JldGlyZWkgZG8gbG9vcAogICAgLy9yZWR1emkgYSB2ZXJpZmljYcOnw6NvIHBlbGEgbWV0YWRlLCBzZSBjaGVnYXIgbmEgbWV0YWRlIGUgdG9kYXMgY29tcGFyYcOnw7VlcyBzw6NvIGlndWFpcyDDqSBwYWzDrW5kcm9tbwogICAgLy9vIGFsZ29yaXRtbyBjb21wYXJhIGEgcHJpbWVpcmEgbWV0YWRlIGNvbSBvIGludmVyc28gbmEgc2VndW5kYSBtZXRhZGUKICAgIGZvciAoaW50IGkgPSB0YW1hbmhvIC8gMjsgaSA+IDA7IGktLSkKICAgIHsKICAgICAgICBpZiAodGV4dG9baV0gIT0gdGV4dG9bdGFtYW5obyAtIGkgLSAxXSkKICAgICAgICB7CiAgICAgICAgICAgIHBhbGluZHJvbW8gPSBmYWxzZTsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgfQogICAgfQogICAgY291dCA8PCBlbmRsIDw8IChwYWxpbmRyb21vID8gIsOJIHBhbMOtbmRyb21vIiA6ICJuw6NvIMOpIHBhbMOtbmRyb21vIik7Cn0=