Условие
Показать переводDecide 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.
Ограничения
0 ≤ length ≤ 10,000
Примеры
Пример 1
Ввод:
text = "Racecar"
Ожидаемый вывод:
expected = True
Ввод:
std::string text = "Racecar";
Ожидаемый вывод:
bool expected = true;
Ввод:
string text = "Racecar";
Ожидаемый вывод:
bool expected = true;
Пояснение
Lowercased, "racecar" reads the same both ways.
Пример 2
Ввод:
text = "hello"
Ожидаемый вывод:
expected = False
Ввод:
std::string text = "hello";
Ожидаемый вывод:
bool expected = false;
Ввод:
string text = "hello";
Ожидаемый вывод:
bool expected = false;
Пояснение
"hello" backwards is "olleh", which is different.
Ссылки
Это задание адаптировано для CodeUtility. Следуйте условию и ограничениям выше.