Problems > Palindrome, Roughly

Palindrome, Roughly

Difficulty: 1100 2000 ms 128 MB

strings

Ignoring everything except letters and digits, and ignoring case, is the line a palindrome?

Input: one line with printable text (letters, digits, spaces, punctuation).

Output: YES or NO.

Constraints:

  • 1 ≤ length ≤ 104

Sample Tests

Input 1
A man, a plan, a canal: Panama
Output 1
YES
Input 2
race a car
Output 2
NO

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.