308542: CF1536B. Prinzessin der Verurteilung

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

Description

Prinzessin der Verurteilung

题意翻译

## 题目描述 定义一个字符串的 $MEX$ 为**在输入中不作为连续子字符串出现的最短字符串**。 如果有长度相同的 $MEX$,则取字典序最小的。 ## 输入格式 第一行输入一个整数 $T$,表示测试组数。 接下来每一组第一行一个整数 $n$,表示该字符串的长度,第二行一个长度为 $n$ 的字符串。 ## 输出格式 输出 $T$ 行,每一行对应一组输入数据的 $MEX$。

题目描述

I, Fischl, Prinzessin der Verurteilung, descend upon this land by the call of fate an — Oh, you are also a traveler from another world? Very well, I grant you permission to travel with me. It is no surprise Fischl speaks with a strange choice of words. However, this time, not even Oz, her raven friend, can interpret her expressions! Maybe you can help us understand what this young princess is saying? You are given a string of $ n $ lowercase Latin letters, the word that Fischl just spoke. You think that the MEX of this string may help you find the meaning behind this message. The MEX of the string is defined as the shortest string that doesn't appear as a contiguous substring in the input. If multiple strings exist, the lexicographically smallest one is considered the MEX. Note that the empty substring does NOT count as a valid MEX. A string $ a $ is lexicographically smaller than a string $ b $ if and only if one of the following holds: - $ a $ is a prefix of $ b $ , but $ a \ne b $ ; - in the first position where $ a $ and $ b $ differ, the string $ a $ has a letter that appears earlier in the alphabet than the corresponding letter in $ b $ . A string $ a $ is a substring of a string $ b $ if $ a $ can be obtained from $ b $ by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end. Find out what the MEX of the string is!

输入输出格式

输入格式


Each test contains multiple test cases. The first line contains the number of test cases $ t $ ( $ 1 \leq t \leq 1000 $ ). Description of the test cases follows. The first line of each test case contains an integer $ n $ ( $ 1 \leq n \leq 1000 $ ) — the length of the word. The second line for each test case contains a single string of $ n $ lowercase Latin letters. The sum of $ n $ over all test cases will not exceed $ 1000 $ .

输出格式


For each test case, output the MEX of the string on a new line.

输入输出样例

输入样例 #1

3
28
qaabzwsxedcrfvtgbyhnujmiklop
13
cleanairactbd
10
aannttoonn

输出样例 #1

ac
f
b

Input

题意翻译

## 题目描述 定义一个字符串的 $MEX$ 为**在输入中不作为连续子字符串出现的最短字符串**。 如果有长度相同的 $MEX$,则取字典序最小的。 ## 输入格式 第一行输入一个整数 $T$,表示测试组数。 接下来每一组第一行一个整数 $n$,表示该字符串的长度,第二行一个长度为 $n$ 的字符串。 ## 输出格式 输出 $T$ 行,每一行对应一组输入数据的 $MEX$。

加入题单

算法标签: