CF1760B.Atilla's Favorite Problem
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
In order to write a string, Atilla needs to first learn all letters that are contained in the string.
Atilla needs to write a message which can be represented as a string s . He asks you what is the minimum alphabet size required so that one can write this message.
The alphabet of size x ( 1≤x≤26 ) contains only the first x Latin letters. For example an alphabet of size 4 contains only the characters a , b , c and d .
输入格式
The first line contains a single integer t ( 1≤t≤1000 ) — the number of test cases.
The first line of each test case contains a single integer n ( 1≤n≤100 ) — the length of the string.
The second line of each test case contains a string s of length n , consisting of lowercase Latin letters.
输出格式
For each test case, output a single integer — the minimum alphabet size required to so that Atilla can write his message s .
输入输出样例
输入#1
5 1 a 4 down 10 codeforces 3 bcf 5 zzzzz
输出#1
1 23 19 6 26
说明/提示
For the first test case, Atilla needs to know only the character a , so the alphabet of size 1 which only contains a is enough.
For the second test case, Atilla needs to know the characters d , o , w , n . The smallest alphabet size that contains all of them is 23 (such alphabet can be represented as the string abcdefghijklmnopqrstuvw ).