LogiQuest

407. Palindrome After One Deletion

EasyTwo Pointers

Print YES if the string can become a palindrome by deleting at most one character, else NO.

Input format

One lowercase string

Output format

YES or NO

Example 1

Input

aba

Output

YES

Example 2

Input

abca

Output

YES

Constraints

1 ≤ |s| ≤ 10⁵

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

Loading the MyLoginn IDE…