#C9972. Palindrome Modification
Palindrome Modification
Palindrome Modification
You are given a string s. Your task is to determine whether it is possible to form a palindrome by removing at most one character from s. A palindrome is a string that reads the same backward as forward. If the string is already a palindrome, it is considered valid.
For example, the string "abca" can be turned into "aba" by removing the character 'c'.
Note: Removal of a character is optional, so strings that are already palindromes should return "YES".
inputFormat
The first line contains an integer T, representing the number of test cases. Each of the following T lines contains one string s.
outputFormat
For each test case, output a single line containing "YES" if the string can be turned into a palindrome by removing at most one character, otherwise output "NO".## sample
3
abca
racecar
abcdef
YES
YES
NO
</p>