Removing Duplicate Customer IDs
Bramley Books exported its mailing list overnight and the export ran twice on part of the file, so some customer numbers appear more than once. The mailing house charges per name and will post a second copy of the catalogue to anyone listed twice, so the list has to be cleaned before it goes out. The mailing house also insists the numbers arrive in increasing order, because its own loader reads them in one pass and rejects a file that jumps backwards.
Task: Print the customer numbers that appear in the export, each shown once.
Input
The first line holds an integer n, the count of lines in the export. Each of the next n lines holds one customer number, a whole number. A number may appear any number of times, and the repeats are not necessarily next to each other.
Output
One line holding the distinct customer numbers in increasing order, separated by single spaces, each written as a plain integer.
Example:
Input:
5
103
101
103
102
101
Output:
101 102 103
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in