310427: CF1832A. New Palindrome

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. New Palindrometime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

A palindrome is a string that reads the same from left to right as from right to left. For example, abacaba, aaaa, abba, racecar are palindromes.

You are given a string $s$ consisting of lowercase Latin letters. The string $s$ is a palindrome.

You have to check whether it is possible to rearrange the letters in it to get another palindrome (not equal to the given string $s$).

Input

The first line contains a single integer $t$ ($1 \le t \le 1000$) — the number of test cases.

The only line of each test case contains a string $s$ ($2 \le |s| \le 50$) consisting of lowercase Latin letters. This string is a palindrome.

Output

For each test case, print YES if it is possible to rearrange the letters in the given string to get another palindrome. Otherwise, print NO.

You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer).

ExampleInput
3
codedoc
gg
aabaa
Output
YES
NO
NO
Note

In the first test case, it is possible to rearrange the letters in the palindrome codedoc to obtain the string ocdedco, which is different from the given string, but also a palindrome.

Input

题意翻译

给你一个由小写字母组成的回文字符串,问你是否能在重排其之后构造出另一个与原串不同的回文字符串。 Translated by @[zhuweiqi](https://www.luogu.com.cn/user/909294)。

Output

题目大意:
回文串是一个从左到右和从右到左读都相同的字符串。例如,`abacaba`、`aaaa`、`abba`、`racecar` 都是回文串。

给定一个由小写拉丁字母组成的回文串 `s`。

你需要检查是否可以重新排列它来得到另一个回文串(不等于给定的 `s`)。

输入输出数据格式:
输入:
- 第一行包含一个整数 `t`(`1 ≤ t ≤ 1000`)——测试用例的数量。
- 每个测试用例只有一行,包含一个字符串 `s`(`2 ≤ |s| ≤ 50`),由小写拉丁字母组成。这个字符串是一个回文串。

输出:
- 对于每个测试用例,如果可以将给定的字符串重新排列得到另一个回文串,则打印 `YES`。否则,打印 `NO`。
- 你可以以任何大小写打印每个字母(`YES`、`yes`、`Yes` 都将被识别为肯定回答,`NO`、`no` 和 `nO` 都将被识别为否定回答)。

示例:
输入:
```
3
codedoc
gg
aabaa
```
输出:
```
YES
NO
NO
```

注意:
- 在第一个测试用例中,可以将回文串 `codedoc` 的字母重新排列得到字符串 `ocdedco`,这与给定的字符串不同,但也是一个回文串。题目大意: 回文串是一个从左到右和从右到左读都相同的字符串。例如,`abacaba`、`aaaa`、`abba`、`racecar` 都是回文串。 给定一个由小写拉丁字母组成的回文串 `s`。 你需要检查是否可以重新排列它来得到另一个回文串(不等于给定的 `s`)。 输入输出数据格式: 输入: - 第一行包含一个整数 `t`(`1 ≤ t ≤ 1000`)——测试用例的数量。 - 每个测试用例只有一行,包含一个字符串 `s`(`2 ≤ |s| ≤ 50`),由小写拉丁字母组成。这个字符串是一个回文串。 输出: - 对于每个测试用例,如果可以将给定的字符串重新排列得到另一个回文串,则打印 `YES`。否则,打印 `NO`。 - 你可以以任何大小写打印每个字母(`YES`、`yes`、`Yes` 都将被识别为肯定回答,`NO`、`no` 和 `nO` 都将被识别为否定回答)。 示例: 输入: ``` 3 codedoc gg aabaa ``` 输出: ``` YES NO NO ``` 注意: - 在第一个测试用例中,可以将回文串 `codedoc` 的字母重新排列得到字符串 `ocdedco`,这与给定的字符串不同,但也是一个回文串。

加入题单

上一题 下一题 算法标签: