Loading...
Loading...
Loading...
A message is a palindrome if it reads the same forwards and backwards after you ignore every character that is not a letter or a digit and ignore the difference between capital and small letters. Print YES or NO.
Example 1
Input
A man, a plan, a canal: Panama
Output
YES
Without spaces and punctuation it is amanaplanacanalpanama.
Example 2
Input
race a car
Output
NO
Try the problem first. Open one hint at a time.
Use two pointers, one at each end of the text.
If a pointer is on a character that is not a letter or digit, move only that pointer.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor