#C4395. Taco: Determine the Highest Scoring Players
Taco: Determine the Highest Scoring Players
Taco: Determine the Highest Scoring Players
Given a list of scores for (n) players, your task is to determine the highest score among them and output this score repeated as many times as it appears in the list. For example, if the highest score is (M) and it appears (k) times in the list, then the expected output is a sequence of (M) repeated (k) times.
Formally, let (S = [s_1, s_2, \ldots, s_n]) be the scores and (M = \max_{1 \le i \le n} s_i). The output should be: [ \underbrace{M, M, \ldots, M}_{k \text{ times}} ]
Note: The output should be printed on a single line with the numbers separated by a single space.
inputFormat
The input is provided via standard input (stdin) and consists of two lines:
- The first line contains an integer (n): the number of players.
- The second line contains (n) space-separated integers representing the scores of the players.
outputFormat
Output via standard output (stdout) a single line containing the highest score repeated as many times as it appears in the input list. The numbers should be separated by a single space.## sample
5
4 8 8 5 8
8 8 8