Remove Duplicates
Time limit5sMemory limit8 MB
Read a space-separated list whose length is not given, keep each value only at its first occurrence, and print the surviving values in order.
- Level
Medium4 of 10
- Topics
- Hash map, Array, Implementation, Bit manipulation
- Solved
- No attempts yet
Problem
You are given integers . Remove every number that has already appeared earlier, and print the remaining numbers in input order. In other words, each value is printed once, at the position where it first appears.
- for .
- The count is between 1 and 5,000,000 inclusive.
Input
The first line contains separated by spaces. itself is not given.
Output
Print on one line, separated by spaces.
Hint
Watch the memory limit.