379. 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 next line should contain the integer target.

Output Format

Print the elements of the array, separated by spaces, after removing 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