735. Remove Duplicates from Sorted List

0

Easy

Given the head of a sorted linked list, remove all duplicate elements so that each element appears only once. Return the updated linked list, which should also be sorted.

Input Format

The input consists of an integer n, representing the number of nodes in the linked list. This is followed by n integers, representing the values of the nodes in the linked list.

Output Format

Print the updated linked list.

Example

Input

4
1 1 2 2

Output

1 2

Constraints

The number of nodes in the linked list is between 0 and 300, inclusive. Each node's value is an integer between -100 and 100. The linked list is guaranteed to be sorted in ascending order.

Loading...

View Submissions

Console