LogiQuest

101. Valid Palindrome (Letters and Digits)

EasyTwo Pointers

Considering only letters and digits and ignoring case, print YES if the line is a palindrome, else NO.

Input format

A single line.

Output format

YES or NO

Example 1

Input

A man, a plan, a canal: Panama

Output

YES

Example 2

Input

race a car

Output

NO

Constraints

1 ≤ |s| ≤ 2 × 10⁵

Read input from standard input and print the answer to standard output. Your code is judged against 6 test cases, most of them hidden.

Loading the MyLoginn IDE…