#C14931. Remove Occurrences

    ID: 44635 Type: Default 1000ms 256MiB

Remove Occurrences

Remove Occurrences

Given an integer list \(lst = [a_1, a_2, \dots, a_k]\) and a target integer \(n\), remove all occurrences of \(n\) from the list. If \(n\) is not present, the list remains unchanged. Write a program that reads from standard input and outputs the updated list to standard output.

For example, if \(lst = [1, 2, 3, 4, 2, 2, 5]\) and \(n = 2\), the resulting list should be \([1, 3, 4, 5]\).

inputFormat

The input consists of two lines. The first line contains space-separated integers representing the list (lst). The second line contains an integer (n) which is to be removed from the list. Note that the list might be empty.

outputFormat

Output the list after removing all occurrences of (n). Print the remaining integers separated by a space. If the list becomes empty, output nothing.## sample

1 3 4 5
2
1 3 4 5