#CF1971B. Different String

    ID: 6893 传统题 1000ms 256MiB 尝试: 1 已通过: 1 难度: 10 上传者: 标签>模拟字符串CodeforcesCodeforces Round 944(Div4)Div4BCF1971B800

Different String

题目描述

给定一个以小写字母构成的字符串 ss

现在你的任务是,重新排列 ss 的字符以形成一个不等于 ss 的新字符串 rr

输入格式

本题单个测试点内包含多组测试数据。

第一行包含一个整数 tt1t10001\leq t\leq 1000),表示测试数据组数。

每个测试用例的唯一一行包含一个字符串 ss,长度最多为 1010,由小写英文字母组成。

输出格式

对于每个测试用例,如果不存在语句中描述的字符串 rr,则输出NO

否则,输出YES。然后,输出一行一个字符串 rr,由字符串 ss 的字母组成。

你可以以任何大小写形式输出YESNO

如果可以有多个答案,则可以输出其中任何一个。

样例

8
codeforces
aaaaa
xxxxy
co
d
nutdealer
mwistht
hhhhhhhhhh
YES
forcodesec
NO
YES
xxyxx
YES
oc
NO
YES
undertale
YES
thtsiwm
NO

样例说明

In the first test case, another possible answer is forcescode \texttt{forcescode} .

In the second test case, all rearrangements of aaaaa \texttt{aaaaa} are equal to aaaaa \texttt{aaaaa} .

来源

Codeforces 1971B,英文题名 Different String。