#C4936. Find the Second Largest Distinct Number
Find the Second Largest Distinct Number
Find the Second Largest Distinct Number
You are given a list of integers. Your task is to find the second largest distinct integer in the list. Formally, let ( S ) be the set of distinct integers extracted from the list. If (|S| < 2), then output (None); otherwise, sort (S) in descending order and return the second element.
For example, if the input list is [4, 6, 2, 1, 9, 9, 63, 566], the distinct numbers are {1, 2, 4, 6, 9, 63, 566} and the second largest is 63.
inputFormat
The input is read from standard input (stdin) and consists of two lines. The first line contains a single integer (n) indicating the number of elements in the list. The second line contains (n) space-separated integers.
outputFormat
Output a single line with the second largest distinct number. If there is no such number, output the string 'None'.## sample
8
4 6 2 1 9 9 63 566
63
</p>