โจทย์
ดูฉบับแปล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 กรุณาทำตามคำชี้แจงและข้อจำกัดด้านบน