#C6800. Remove Repeated Waypoints
Remove Repeated Waypoints
Remove Repeated Waypoints
Given a list of waypoints, your task is to remove all repeated waypoints while keeping only the first occurrence of each waypoint. In other words, if a waypoint appears multiple times in the list, only the first appearance should be kept and all subsequent duplicates removed.
Formally, given an integer and a sequence , produce a sequence such that each appears in the order of their first occurrence in the given sequence and no element appears more than once.
inputFormat
The input is given via standard input. The first line contains an integer , representing the number of waypoints. The second line contains space-separated integers, where each integer represents a waypoint.
outputFormat
Output the unique waypoints in the order they first appeared, separated by a single space. If there are no waypoints, output an empty line.## sample
5
1 2 3 2 1
1 2 3