CJCoding With Joseph
15free / daySign inCreate account

Unique Numbers from Input

Write a program that reads an integer N from standard input followed by N integers (all separated by whitespace). Insert the N integers into a set<int> and print the distinct values in ascending order on one line, separated by single spaces, followed by a newline (a trailing space after the last value is fine).

Example input:
5
3 1 3 2 1

The output for that input is shown in Expected Output.

Expected Output:

1 2 3
5 10 15 20

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
STL ContainersSets
📥 Auto-Input:
5\n3 1 3 2 1\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.