Problème
Afficher l’original (anglais)Décidez si text est un palindrome, en ne considérant que les lettres et les chiffres et en ignorant la casse.
Implémentez is_palindrome(text).
Entrée
text : Le texte à vérifier (caractères ASCII).
Sortie
Retournez true si c'est un palindrome, sinon false.
Contraintes
0 ≤ longueur ≤ 10 000
Exemples
Entrée :
text = "Racecar"
Sortie attendue :
expected = True
Entrée :
std::string text = "Racecar";
Sortie attendue :
bool expected = true;
Entrée :
string text = "Racecar";
Sortie attendue :
bool expected = true;
Explication
En minuscules, "racecar" se lit de la même façon dans les deux sens.
Entrée :
text = "hello"
Sortie attendue :
expected = False
Entrée :
std::string text = "hello";
Sortie attendue :
bool expected = false;
Entrée :
string text = "hello";
Sortie attendue :
bool expected = false;
Explication
"hello" à l'envers donne "olleh", qui est différent.
Références
Ce défi a été adapté pour CodeUtility. Suivez l'énoncé et les contraintes ci-dessus.