Game of String
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Description
小A得到了一个有小写字母组成长度为 的序列 (表示为 ),目标是把它变成回文字符串,他可以做以下操作:
- 交换字符串中的 与 ,其中 。
请问小A是否可以通过有限次操作将字符串转换为回文字符串。
回文字符串:“回文串”是一个正读和反读都一样的字符串,比如“ level”或者“ noon”等等就是回文串。
Input Format
每组测试包含多个测试用例。第一行包含测试用例数量 ,下面是测试用例的描述。
每个测试用例包含一个字符串 。
Output Format
对于每个测试用例,应该输出单个字符串。
如果判断该组样例可以转换为回文串则输出YES,反之则输出NO。
3
baa
aaa
ab
YES
YES
NO
Hint
Note
第一组样例中:交换 与 位置即可将字符串转化为回文串“ aba”
2023年第五届秋季校赛第二周训练预备赛补题通道
- Status
- Done
- Rule
- ACM/ICPC
- Problem
- 13
- Start at
- 2023-11-21 14:00
- End at
- 2023-11-25 14:00
- Duration
- 96 hour(s)
- Host
- Partic.
- 18