समस्या
अनुवाद दिखाएँ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 के लिए अनुकूलित की गई है। ऊपर दिए गए स्टेटमेंट और सीमाओं का पालन करें।