#P16960. [SCCPC 2026] 那一天的回文字符串
[SCCPC 2026] 那一天的回文字符串
Background
:::align{center}
:::
:::epigraph[We still do not know the name of the flower we saw that day] We have never heard its name, but we remember its fragrance; when we meet the flower again, tears have already streamed down. :::
Problem Description
One day, Menma and Jintan came across a string consisting of lowercase English letters.
To kill time, they invented a game: Menma can reorder the characters at all odd indices of the string in any way, and Jintan can reorder the characters at all even indices of the string in any way.
They want to know whether, after such reordering, the string can be turned into a palindrome. Please help them.
A palindrome is a string that reads the same from left to right and from right to left. For example, , , and are palindromes, while , , and are not.
Input Format
The first line contains an integer (), the number of testdata sets.
For each testdata set, the only line contains a string consisting of lowercase English letters ().
Output Format
For each testdata set, if can be turned into a palindrome, output one line with "YES"; otherwise, output one line with "NO".
You may output the answer in any letter case. For example, "yEs", "yes", "Yes", and "YES" will all be accepted.
5
abba
abcd
aabb
abcba
abcde
YES
NO
YES
YES
NO
Hint
In the first testdata set, the given string itself is already a palindrome.
In the third testdata set, you can reorder the characters at odd indices so that index is and index is ; at the same time, reorder the characters at even indices so that index is and index is . This way, you can get the palindrome .
Translated by ChatGPT 5