#K3931. Remove Duplicates from Sorted Array

    ID: 26392 Type: Default 1000ms 256MiB

Remove Duplicates from Sorted Array

Remove Duplicates from Sorted Array

Given a sorted integer array, remove the duplicates in-place so that each unique element appears only once. The relative order of the unique elements should be maintained, and the remaining positions in the array should be filled with the underscore symbol (_).

Input Format: The input is provided via stdin. The first line contains an integer n representing the number of elements in the array. The second line contains n space-separated integers in non-decreasing order.

Output Format: Print the modified array to stdout where the unique elements appear first in their original order, followed by underscores (_) filling the remaining positions. Separate all values by a single space.

Note: Use LaTeX format for all formulas if needed. For example, the number of elements can be represented as \(0 \le n \le 10^5\).

inputFormat

The first line contains an integer \(n\) (where \(0 \le n \le 10^5\)) indicating the number of elements in the array. The second line contains \(n\) space-separated integers sorted in non-decreasing order.

outputFormat

Output the modified array on a single line. The first part consists of the unique elements in their original order, and the rest of the array is filled with the underscore symbol (_). All elements are separated by a single space.

## sample
3
1 1 2
1 2 _

</p>