#P16960. [SCCPC 2026] 那一天的回文字符串

    ID: 19044 远端评测题 1000ms 1024MiB 尝试: 0 已通过: 0 显示难度普及− 上传者: 标签>模拟字符串四川Special Judge2026省赛/邀请赛

[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 ss 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, aa\mathtt{aa}, aba\mathtt{aba}, and abccba\mathtt{abccba} are palindromes, while sccpc\mathtt{sccpc}, reality\mathtt{reality}, and ab\mathtt{ab} are not.

Input Format

The first line contains an integer tt (1t1001 \le t \le 100), the number of testdata sets.

For each testdata set, the only line contains a string ss consisting of lowercase English letters (1s1001 \le |s| \le 100).

Output Format

For each testdata set, if ss 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 11 is a\mathtt{a} and index 33 is b\mathtt{b}; at the same time, reorder the characters at even indices so that index 22 is b\mathtt{b} and index 44 is a\mathtt{a}. This way, you can get the palindrome abba\mathtt{abba}.

Translated by ChatGPT 5