#C14480. Second Smallest Unique Integer
Second Smallest Unique Integer
Second Smallest Unique Integer
Given a list of numbers, determine the second smallest unique integer. Let \(A\) be the input list and \(S = \{ x \mid x \in A \}\) be the set of unique integers from the list. If \(|S| < 2\), then output "Not enough unique integers in the list.". If any of the inputs is not a valid integer, output "Invalid input: all elements must be integers".
The input is provided as a line from standard input, consisting of space-separated tokens. Your program should convert these tokens to integers and process them accordingly.
inputFormat
The input consists of a single line from standard input containing space-separated tokens. These tokens are expected to represent integers. The list may be empty.
outputFormat
If the list contains at least two unique integers, output the second smallest unique integer to standard output. Otherwise, output one of the following error messages exactly:
- "Not enough unique integers in the list." if there are fewer than two unique integers.
- "Invalid input: all elements must be integers" if any token cannot be parsed as an integer.
1 2 3 4 5
2