Algumas palavras se leem igual de trás para frente, como level e noon. Escreva same_both_ways(word): o código inicial já copia a palavra para back; use reverse para inverter back e depois compare com word. Maiúsculas diferentes contam como diferentes; uma palavra vazia conta como igual.
same_both_ways("level")→Truesame_both_ways("hello")→Falsebool same_both_ways(const string &word)#include <algorithm>
#include <string>
using namespace std;
bool same_both_ways(const string &word) {
string back = word;
// seu código aqui: inverta back
return back == word;
}
Executar testa os exemplos. Quando parecerem certos, Enviar.