Contests Virtual Contests Problems Submit Runs Status Rank List Forum

2771.   Don't Be Late
Time Limit: 1.0 Seconds   Memory Limit: 65536K
Total Runs: 1429   Accepted Runs: 428

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.

### Input

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

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.

### Constraints

• S contains letters ('A'-'Z', 'a'-'z') only.
• The length of S is greater than 0 and no larger than 1000000.
• ### Sample Input

2
babbcACbcbab


### Sample Output

b
A


Source: The 5th UESTC Programming Contest Warmup
Submit   List    Runs   Forum   Statistics

Tianjin University Online Judge v1.3.0
Maintance:Fxz. Developer: SuperHacker, G.D.Retop, Fxz