Some students are always late for the classes in UESTC. In order to make the students go to class earlier, President Zhou decides to punish the people who are often late for class. He asks WCM to take charge to record the name if someone is late. At the end of every month, the person who was recorded the most times would be punished heavily. But the record is usually so large that WCM caní»t find the person who appears the most times. You should help him.
Given a string, each letter represents a person who is recorded by WCM. And you should output the letter that appears the most times in the string. If more than one letter has the most occurrences, just output the letter that has the minimal ASCII value.
The fist line contains a positive integer T
, indicating the number of the test cases. In the next T
lines, each line contains a string S
Output the letter that appears the most times in S
. If more than one letter applies, just output the letter that has the minimal ASCII value.
S contains letters ('A'-'Z', 'a'-'z') only.
The length of S is greater than 0 and no larger than 1000000.