Đề bài
Xem bản dịchDecide 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.
Ràng buộc
0 ≤ length ≤ 10,000
Ví dụ
Ví dụ 1
Đầu vào:
text = "Racecar"
Kết quả mong đợi:
expected = True
Đầu vào:
std::string text = "Racecar";
Kết quả mong đợi:
bool expected = true;
Đầu vào:
string text = "Racecar";
Kết quả mong đợi:
bool expected = true;
Giải thích
Lowercased, "racecar" reads the same both ways.
Ví dụ 2
Đầu vào:
text = "hello"
Kết quả mong đợi:
expected = False
Đầu vào:
std::string text = "hello";
Kết quả mong đợi:
bool expected = false;
Đầu vào:
string text = "hello";
Kết quả mong đợi:
bool expected = false;
Giải thích
"hello" backwards is "olleh", which is different.
Tham khảo
Thử thách này đã được điều chỉnh cho CodeUtility. Hãy làm theo đề bài và các ràng buộc ở trên.