Problem
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.
Constraints
0 ≤ length ≤ 1,000
Examples
Input:
text = "Never odd or even"
Expected output:
expected = True
Input:
std::string text = "Never odd or even";
Expected output:
bool expected = true;
Input:
string text = "Never odd or even";
Expected output:
bool expected = true;
Explanation
Letters only, lowercased: "neveroddoreven" reads the same both ways.
Input:
text = "code"
Expected output:
expected = False
Input:
std::string text = "code";
Expected output:
bool expected = false;
Input:
string text = "code";
Expected output:
bool expected = false;
Explanation
"c" and "e" differ, so it is not a palindrome.
References
This challenge is adapted for CodeUtility. Follow the statement and constraints above.