#C12441. Find the Top Three Unique Scores
Find the Top Three Unique Scores
Find the Top Three Unique Scores
You are given a list of integers representing scores. Your task is to find the top three unique highest scores and output them in descending order. If there are fewer than three unique scores, output all of them in descending order.
For example, if the scores are 70 85 85 90 92 60 76 92
, the top three unique scores are 92, 90, 85
.
The solution must read input from stdin and output the result to stdout. In the case of an empty input, output nothing.
All numbers in the input can be assumed to be valid integers separated by spaces.
Note: If any invalid input is encountered (i.e. non-integer values), the program should raise an appropriate error or exit.
inputFormat
The input is provided as a single line on stdin
containing space-separated integers.
outputFormat
Print to stdout
the top three unique highest scores in descending order, separated by a single space. If there are fewer than three unique scores, print all of them in descending order. For an empty input, print nothing.
70 85 85 90 92 60 76 92
92 90 85