#K62172. Unique Descending Order
Unique Descending Order
Unique Descending Order
Given a list of integers, your task is to remove all duplicate elements and then output the remaining unique integers in descending order. Formally, for a given list \(a_1, a_2, \dots, a_n\), you need to produce a list that contains every distinct integer from the input, sorted from the highest to the lowest.
The input is read from standard input and the output is written to standard output. Please ensure that your solution handles edge cases such as an empty list or a list with just one element.
inputFormat
The first line contains an integer \(N\) representing the number of elements. If \(N > 0\), the next line contains \(N\) space-separated integers representing the list.
For example:
7 4 5 2 5 8 2 1
outputFormat
Output the unique integers sorted in descending order on a single line, separated by a single space. If there are no integers to process, output nothing.
For example:
8 5 4 2 1## sample
7
4 5 2 5 8 2 1
8 5 4 2 1