Problem
Übersetzung anzeigenDecide 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.
Einschränkungen
0 ≤ length ≤ 10,000
Beispiele
Eingabe:
text = "Racecar"
Erwartete Ausgabe:
expected = True
Eingabe:
std::string text = "Racecar";
Erwartete Ausgabe:
bool expected = true;
Eingabe:
string text = "Racecar";
Erwartete Ausgabe:
bool expected = true;
Erläuterung
Lowercased, "racecar" reads the same both ways.
Eingabe:
text = "hello"
Erwartete Ausgabe:
expected = False
Eingabe:
std::string text = "hello";
Erwartete Ausgabe:
bool expected = false;
Eingabe:
string text = "hello";
Erwartete Ausgabe:
bool expected = false;
Erläuterung
"hello" backwards is "olleh", which is different.
Referenzen
Diese Aufgabe wurde für CodeUtility angepasst. Beachte die oben genannten Vorgaben und Einschränkungen.