Top Three Scores
Given a list of integer scores, find the three highest distinct scores. If there are fewer than three distinct scores, print all distinct scores in descending order. Print the scores separated by spaces. If there are ties for the third highest score, include all scores equal to the third highest.
Input
The first line contains an integer N, the number of scores. The second line contains N space-separated integers representing the scores.
Output
Print the top three distinct scores in descending order, separated by spaces. If there are fewer than three distinct scores, print all distinct scores in descending order.
Constraints
1 <= N <= 1000. Each score will be an integer between 0 and 10^9.
Example 1
7 80 90 70 100 85 95 75
100 95 90
The distinct scores are 70, 75, 80, 85, 90, 95, 100. The top three are 100, 95, 90.
Example 2
5 100 100 100 100 100
100
There is only one distinct score: 100.
Hints
# Read the input from stdin and print the answer.
import sys
def main():
data = sys.stdin.read().split()
# your code here
main()
7 80 90 70 100 85 95 75
5 100 100 100 100 100