#K35057. Palindrome After One Deletion
Palindrome After One Deletion
Palindrome After One Deletion
You are given a string s. Determine whether you can make s a palindrome by removing at most one character.
A palindrome is a string that reads the same forwards and backwards. Mathematically, a string s is a palindrome if
\( s = s^R \)
where \( s^R \) is the reverse of string s.
If the string can be made a palindrome by deleting at most one character, print YES
. Otherwise, print NO
.
Note: The input will contain multiple test cases.
inputFormat
The first line of input contains an integer t denoting the number of test cases. Each of the following t lines contains a single string s.
outputFormat
For each test case, output a single line containing YES
if you can remove at most one character to make the string a palindrome, otherwise output NO
.## sample
1
abba
YES
</p>