Problema
Mostra traduzioneDecide 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.
Vincoli
0 ≤ length ≤ 10,000
Esempi
Esempio 1
Input:
text = "Racecar"
Output atteso:
expected = True
Input:
std::string text = "Racecar";
Output atteso:
bool expected = true;
Input:
string text = "Racecar";
Output atteso:
bool expected = true;
Spiegazione
Lowercased, "racecar" reads the same both ways.
Esempio 2
Input:
text = "hello"
Output atteso:
expected = False
Input:
std::string text = "hello";
Output atteso:
bool expected = false;
Input:
string text = "hello";
Output atteso:
bool expected = false;
Spiegazione
"hello" backwards is "olleh", which is different.
Riferimenti
Questa sfida è adattata per CodeUtility. Segui la traccia e i vincoli sopra.