#C8841. Find Duplicates in Sequence
Find Duplicates in Sequence
Find Duplicates in Sequence
Problem Description:
You are given a sequence of integers. Your task is to find and print all the elements that appear strictly more than once in the sequence. The output should list the duplicate elements in the order of their first occurrence in the input sequence.
For example, if the input sequence is [1, 2, 3, 4, 3], the output should be [3].
inputFormat
Input Format:
The first line contains an integer (n), the number of elements in the sequence. The second line contains (n) space-separated integers.
outputFormat
Output Format:
Print the duplicate elements in the order of their first occurrence, separated by a single space. If there are no duplicates, print an empty line.## sample
5
1 2 3 4 3
3
</p>