|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||158||65||60||41.667%|
In cryptography, a substitution cipher is a method of encryption by which units (usually, single letters) of plaintext are substituted with ciphertext. One of the simplest ways substitutes a plaintext alphabet by a ciphertext alphabet. For example, if you are given the following alphabets,
A message of “hello there” is encrypted into “xvssc kxvbv” using the above substitution method.
One interesting fact is that in the English literature, the letter ‘e’ is known as the most frequent one among the English alphabet. Hence, when you try to decrypt an encrypted text without the ciphertext alphabet, you can guess which letter in the ciphertext alphabet would imply ‘e’ by counting the number of appearances of each letter in the encrypted text.
You are to write a program that counts each letter in an encrypted text and prints out the most frequent one using the above idea. If there are more than one most frequent letters in the given text, your program should print out ‘?’, meaning “no idea”, because you could not be sure that which one would match ‘e’ in the plaintext alphabet.
Your program is to read the input from standard input. The input consists of T (1 ≤ T ≤ 20) test cases. The number of test cases T is given in the first line of the input. Each test case is given by a string of the English alphabet of lowercase and spaces, line by line, with length between 1 and 255.
Your program is to write to standard output. For each test case, print out the most frequent letter or ‘?’ if there are more than one most frequent letters, in one line.
3 asvdge ef ofmdofn xvssc kxvbv hull full suua pmlu
f v ?