#K39727. Duplicate Participant IDs
Duplicate Participant IDs
Duplicate Participant IDs
You are given a list of participant IDs. Your task is to identify all IDs that appear more than once and output them in ascending order. If there are no duplicate IDs, output No duplicates
.
More formally, let \(L = [a_1, a_2, \ldots, a_n]\) be the list of participant IDs. You need to find all \(x\) such that the count of \(x\) in \(L\) is greater than 1. If the set of such \(x\) is non-empty, output the sorted list of these \(x\)'s separated by spaces. Otherwise, output No duplicates
.
Note: Read the input from standard input and write the output to standard output.
inputFormat
The input consists of two lines:
- The first line contains a single integer \(n\) representing the number of participant IDs.
- The second line contains \(n\) space-separated integers representing the participant IDs.
outputFormat
If there are any duplicate IDs, output them in ascending order as a space-separated string. Otherwise, output No duplicates
.
6
1 2 3 4 5 6
No duplicates