404649: GYM101604 A Almost Palindrome

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Almost Palindrometime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

A string is considered palindrome if it's the same if you read it from the left or from the right (if it stays the same when you reverse it).

In this problem you are given a string, and your task is to swap 2 characters at different positions to make the string palindrome (note that you must do this step exactly once).

Input

The input contains just 1 line which is the string you are going to check, the string consists of at least 2 and at most 500,000 lower case English letters.

Output

Print "YES" if you can make the given string palindrome by applying the above step exactly once, otherwise print "NO".

ExamplesInput
ab
Output
NO
Input
aba
Output
YES
Input
axax
Output
YES
Note

In the second test case, you can swap the first and last characters (which won't make any change), and the string will stay palindrome.

P.S. The judge is cute enough today and didn't allow strings with length 1.

加入题单

上一题 下一题 算法标签: