#C775. Palindrome Transformation Challenge
Palindrome Transformation Challenge
Palindrome Transformation Challenge
You are given a string s and you need to determine whether it can be transformed into a palindrome by changing at most one character. A palindrome is a string that reads the same forward and backward. In mathematical terms, a string s of length n is a palindrome if for all indices \( i \) such that \( 0 \leq i < n \), the equality \( s[i] = s[n-i-1] \) holds.
Your task is to decide if the given string can become a palindrome by modifying at most one character. If it can, print "YES"; otherwise, print "NO".
Note: The input will consist of multiple test cases. Read the input from standard input (stdin) and output the result for each test case on a separate line to standard output (stdout).
inputFormat
The input begins with an integer T representing the number of test cases. Each of the following T lines contains a single string s.
Format:
T
s_1
s_2
...
s_T
outputFormat
For each test case, output "YES" if the string can be turned into a palindrome by modifying at most one character; otherwise, output "NO". Each result must be printed on a new line.
## sample3
abca
abcd
racecar
YES
NO
YES
</p>