#C11007. Make a Palindrome

    ID: 40276 Type: Default 1000ms 256MiB

Make a Palindrome

Make a Palindrome

You are given a string s consisting of lowercase English letters. Your task is to determine whether it is possible to make the string a palindrome by removing at most one character.

A string is a palindrome if it reads the same backward as forward. For example, "abcba" is a palindrome, whereas "abc" is not. Sometimes, by removing one character from a non-palindrome string, it can become a palindrome.

Input: A single string provided via standard input (stdin).

Output: Print "YES" if the string can be turned into a palindrome by removing at most one character; otherwise, print "NO". The output should be written to standard output (stdout).

Examples:

  • Input: abca → Output: YES
  • Input: abc → Output: NO

Note: The removal of a character is optional if the string is already a palindrome.

inputFormat

A single line containing the string s.

outputFormat

A single line containing either "YES" or "NO".## sample

abca
YES