#K36672. Find Top Scorers
Find Top Scorers
Find Top Scorers
Given multiple test cases, each representing a group of players with their names and scores, your task is to determine the top scorer(s) for each test case. For each test case, if there are multiple players who obtain the highest score, output their names in alphabetical order, separated by commas, followed by a space and then the score. If a test case contains no entries, output an empty line.
Formally, for each test case with a set of pairs \((name, score)\):
Find all names where \(score = \max(score)\) and sort these names alphabetically. Output the sorted names as a comma-separated list, followed by a space and the highest score.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains an integer \(T\) representing the number of test cases.
- For each test case:
- The first line contains an integer \(N\), the number of entries.
- The next \(N\) lines each contain a string (the player's name) and an integer (the player's score), separated by a space.
outputFormat
For each test case, output one line to standard output (stdout). If the test case contains entries, print the top scorer(s) as follows:
A comma-separated list of names (sorted in alphabetical order) followed by a space and the top score.
If the test case has no entries, output an empty line.
## sample3
4
Alice 10
Bob 15
Charlie 15
David 8
3
Eve 20
Alice 20
Bob 19
1
Alice 5
Bob,Charlie 15
Alice,Eve 20
Alice 5
</p>