#K55227. Pseudo Palindrome Check
Pseudo Palindrome Check
Pseudo Palindrome Check
Given a string \(s\) consisting of lowercase English letters, determine whether it can be transformed into a palindrome by removing at most one character. A string is a pseudo-palindrome if it is already a palindrome or if it can become a palindrome by the removal of a single character.
The input string \(s\) satisfies \(1 \leq |s| \leq 1{,}000{,}000\). Your task is to check if \(s\) is a pseudo-palindrome and output YES
if it is, or NO
otherwise.
Note: A palindrome is a string that reads the same forwards and backwards.
inputFormat
The input consists of a single line that contains the string \(s\). The string contains only lowercase English letters.
outputFormat
Output a single line: YES
if the string is a pseudo-palindrome, or NO
otherwise.
abca
YES