Условие
Decide whether text reads the same forwards and backwards, considering only letters and digits and ignoring case. Solve it recursively: compare the outer characters, then check the inside.
Implement is_palindrome_recursive(text).
Input
text: The text to check (ASCII characters).
Output
Return true for a palindrome, otherwise false.
Ограничения
0 ≤ length ≤ 1,000
Примеры
Ввод:
text = "Never odd or even"
Ожидаемый вывод:
expected = True
Ввод:
std::string text = "Never odd or even";
Ожидаемый вывод:
bool expected = true;
Ввод:
string text = "Never odd or even";
Ожидаемый вывод:
bool expected = true;
Пояснение
Letters only, lowercased: "neveroddoreven" reads the same both ways.
Ввод:
text = "code"
Ожидаемый вывод:
expected = False
Ввод:
std::string text = "code";
Ожидаемый вывод:
bool expected = false;
Ввод:
string text = "code";
Ожидаемый вывод:
bool expected = false;
Пояснение
"c" and "e" differ, so it is not a palindrome.
Ссылки
Это задание адаптировано для CodeUtility. Следуйте условию и ограничениям выше.