#K46502. One Removal Palindrome
One Removal Palindrome
One Removal Palindrome
Given a string S, determine whether it is possible to obtain a palindrome by removing at most one character from S. A palindrome is a string that reads the same backward as forward. Formally, a string S is a palindrome if for all indices \( 0 \le i < |S| \), the equality \( S[i] = S[|S|-1-i] \) holds.
You are allowed to remove exactly one character (or no character) from the string. Your task is to check if the resulting string can be a palindrome. If it is possible, output YES; otherwise, output NO.
Input Constraints: \( 0 \leq |S| \leq 10^5 \).
inputFormat
The input consists of a single line containing the string S. The string may be empty, and it consists of printable ASCII characters.
outputFormat
Output a single line with YES if the string can be transformed into a palindrome by removing at most one character, otherwise output NO.
## sampleracecar
YES