#C10951. One-Swap Palindrome Transformation

    ID: 40213 Type: Default 1000ms 256MiB

One-Swap Palindrome Transformation

One-Swap Palindrome Transformation

Given a string S consisting of lowercase letters, determine whether it is possible to transform S into a palindrome by performing exactly one swap operation. In this operation, you select any two distinct characters and swap all occurrences of one with the other throughout the string.

A string is considered a palindrome if it reads the same backward as forward, i.e. if \(S = S^R\) where \(S^R\) is the reverse of \(S\).

You are given one or more test strings, and your task is to print "YES" if the transformation is possible for each string, or "NO" otherwise.

Note: The operation swaps all instances of the chosen characters simultaneously.

inputFormat

The first line contains an integer T, the number of test cases.

Each of the next T lines contains a non-empty string S consisting of lowercase letters only.

outputFormat

For each test case, output a single line containing either "YES" or "NO". "YES" indicates that it is possible to convert the string into a palindrome using exactly one swap of all occurrences of two distinct characters, and "NO" indicates that it is not possible.

## sample
3
ab
aabbcc
abc
YES

YES NO

</p>