LogiQuest

27. Palindrome Check

EasyStringTwo Pointers

A phrase is a palindrome if, after converting to lowercase and removing all non-alphanumeric characters, it reads the same forwards and backwards. Print YES or NO.

Input format

A single line of text.

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 ≤ length ≤ 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…