#K86932. One Removal Palindrome
One Removal Palindrome
One Removal Palindrome
You are given T strings. For each string, you need to determine if it is possible to obtain a palindrome by removing at most one character. A palindrome is a string that reads the same forward and backward.
Note: Even if the string is already a palindrome, the answer is "YES".
Example:
Input: 3 abca racecar abcdef</p>Output: YES YES NO
inputFormat
The input is read from standard input and consists of multiple lines. The first line contains a single integer T
(1 ≤ T ≤ 105), denoting the number of test cases. The following T lines each contain a single string consisting of lowercase English letters. The length of each string is between 1 and 105.
outputFormat
For each test case, output a single line with either "YES" if the string can become a palindrome by removing at most one character, or "NO" otherwise.
## sample3
abca
racecar
abcdef
YES
YES
NO
</p>