atcoder#ARC133A. [ARC133A] Erase by Value
[ARC133A] Erase by Value
Score : points
Problem Statement
Given is a sequence of integers .
Snuke now chooses a value in . Let be the value chosen. Then, he makes an integer sequence by lining up all elements of that are not without changing the order.
Find the lexicographically smallest sequence that can be obtained as .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the elements of the lexicographically smallest , separated by spaces.
5
2 4 4 1 2
2 1 2
For example, when , we will have . When , we will have , which is the lexicographically smallest.
3
1 1 1
When , will be empty, which is obviously the lexicographically smallest. As a side note, the output may contain additional spaces or newlines.
5
1 1 2 3 3
1 1 2