Problème
Afficher la traductionDecide whether text is a palindrome, considering only letters and digits and ignoring case.
Implement is_palindrome(text).
Input
text: The text to check (ASCII characters).
Output
Return true for a palindrome, otherwise false.
Contraintes
0 ≤ length ≤ 10,000
Exemples
Exemple 1
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
Lowercased, "racecar" reads the same both ways.
Exemple 2
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" backwards is "olleh", which is different.
Références
Ce défi a été adapté pour CodeUtility. Suivez l'énoncé et les contraintes ci-dessus.