#C14844. Second Largest Distinct Number
Second Largest Distinct Number
Second Largest Distinct Number
Given a list of integers, your task is to find the second largest distinct number. In other words, you need to identify the second largest value among the unique elements of the list.
If the list does not contain at least two distinct numbers, output InsufficientDistinctElements
.
Mathematically, if the list of integers is \(a_1, a_2, \ldots, a_n\) and the set of unique numbers is \(S = \{a_1, a_2, \ldots, a_n\}\), you must output the second highest number in \(S\). If \(|S| < 2\), output the error message.
inputFormat
The input is provided via standard input (stdin) as a single line containing space-separated integers. The line could be empty.
outputFormat
If the list contains at least two distinct integers, output the second largest distinct integer to standard output (stdout). Otherwise, output the exact string InsufficientDistinctElements
.
3 1 4 1 5 9 2 6 5 3 5
6