欢迎光临散文网 会员登陆 & 注册

CF 1722A. Spell Check

2023-08-23 13:21 作者:您是打尖儿还是住店呢  | 我要投稿

Timur likes his name. As a spelling of his name, he allows any permutation of the letters of the name. For example, the following strings are valid spellings of his name: Timur, miurT, Trumi, mriTu. Note that the correct spelling must have uppercased T and lowercased other letters.


Today he wrote string s of length n consisting only of uppercase or lowercase Latin letters. He asks you to check if s is the correct spelling of his name.

Input

The first line of the input contains an integer t (1≤t≤103) — the number of test cases.

The first line of each test case contains an integer n (1≤n≤10) — the length of string s.

The second line of each test case contains a string s consisting of only uppercase or lowercase Latin characters.

Output

For each test case, output "YES" (without quotes) if s satisfies the condition, and "NO" (without quotes) otherwise.

You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).

--------------------------------

帖木儿喜欢他的名字。 作为他名字的拼写,他允许名字字母的任何排列。 例如,以下字符串是他名字的有效拼写:Timur、miurT、Trumi、mriTu。 请注意,正确的拼写必须是大写的 T 和小写的其他字母。


今天他写了长度为 n 的字符串 s,仅由大写或小写拉丁字母组成。 他要求你检查 s 是否是他名字的正确拼写。

输入

输入的第一行包含一个整数 t (1≤t≤103) — 测试用例的数量。

每个测试用例的第一行包含一个整数n(1≤n≤10)——字符串s的长度。

每个测试用例的第二行包含一个仅由大写或小写拉丁字符组成的字符串 s。

输出

对于每个测试用例,如果 s 满足条件,则输出“YES”(不带引号),否则输出“NO”(不带引号)。

您可以在任何情况下输出答案(例如,字符串“yEs”、“yes”、“Yes”和“YES”将被识别为肯定答案)。

---------------------

字符串排序,合并匹配问题,easy题目;

下面是代码:


CF 1722A. Spell Check的评论 (共 条)

分享到微博请遵守国家法律