772. Remove an element from an array

0

Easy

Given an integer N and an array of size N containing integers, along with an integer target, the task is to remove all occurrences of the target value from the array. The relative order of the elements in the array should remain unchanged. It is required to solve this problem by modifying the input array in place, without using any additional space.

Input Format

The first line of the input should contain an integer N, followed by N space-separated integers on a separate line representing the elements of the array. The integer target should be provided on the next line.

Output Format

Print the elements of the modified array, separated by spaces, without including the target value.

Example

Input

4 3 2 2 3 3

Output

2 2

Constraints

0 <= N <= 100
0 <= arr[i] <= 50
0 <= target <= 100
Loading...

View Submissions

Console