#C14806. Remove Duplicates Preserving Order

    ID: 44496 Type: Default 1000ms 256MiB

Remove Duplicates Preserving Order

Remove Duplicates Preserving Order

You are given a list of integers. Your task is to remove duplicate integers while maintaining the original order of their first appearance.

Input Format: The first line contains an integer n indicating the number of integers. The second line contains n space-separated integers.

Output Format: Output the list after removing duplicates while preserving the order. The integers should be printed on one line, separated by a single space.

Use \( \texttt{set} \) or similar data structures in your solution if needed to track duplicate entries.

inputFormat

The input consists of two lines:

  • The first line contains a single integer \( n \), the number of elements in the list.
  • The second line contains \( n \) space-separated integers.

outputFormat

Output a single line containing the unique integers from the list in their original order, separated by a space.

## sample
7
4 5 6 5 4 7 8
4 5 6 7 8