#K70197. Almost Palindrome

    ID: 33255 Type: Default 1000ms 256MiB

Almost Palindrome

Almost Palindrome

In this problem, you are given a string ( s ) and you need to determine whether it is possible to form a palindrome by removing at most one character from ( s ). A string is a palindrome if it reads the same forwards and backwards. In other words, you need to check if ( s ) is already a palindrome or if it can be converted into one by deleting a single character.

For example, for the string abca, by removing the character 'c' or 'b', the string becomes aba which is a palindrome, so the answer is "YES". On the other hand, for the string abcdef, no single deletion can make it a palindrome, so the answer is "NO".

inputFormat

The input consists of a single line containing the string ( s ). The string may be empty and can be of large length (up to ( 10^5 ) characters).

outputFormat

Output a single line: "YES" if it is possible to make the string a palindrome by removing at most one character, and "NO" otherwise.## sample

abca
YES