101911: [AtCoder]ABC191 B - Remove It

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $200$ points

Problem Statement

Given are an integer sequence $A$ of length $N$, and an integer $X$.
Remove all elements that are equal to $X$ from $A$, and arrange the remaining elements without changing the order to obtain the sequence $A'$. Print $A'$.

Constraints

  • $1 \le N \le 10^5$
  • $1 \le X \le 10^9$
  • $1 \le A_i \le 10^9$
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

$N$ $X$
$A_1$ $A_2$ $A_3$ $\dots$ $A_N$

Output

Print the elements of $A'$ in order, with space in between.


Sample Input 1

5 5
3 5 6 5 4

Sample Output 1

3 6 4

Removing $5$s from $[3, 5, 6, 5, 4]$ results in $[3, 6, 4]$.


Sample Input 2

3 3
3 3 3

Sample Output 2


$A'$ can be a sequence with zero elements, in which case we should just print an empty line.

Input

题意翻译

给定长度为 $N$ 的整数数列 $A$ 和整数 $X$ ,从数列 $A$ 中删除所有与 $X$ 相等的数字,并输出剩余按原本顺序排列的数字。

加入题单

上一题 下一题 算法标签: