#K49317. Filter Non-Negative Integers
Filter Non-Negative Integers
Filter Non-Negative Integers
You are given a list of integers. Your task is to filter out all the negative numbers and output a new list that preserves the original order of the non-negative integers. In other words, from a list \(L = [a_1, a_2, \dots, a_n]\), you need to output all \(a_i\) such that \(a_i \ge 0\).
The problem emphasizes maintaining the order of the elements. The filtered result should include zeros as well as positive integers.
inputFormat
The first line of input contains an integer \(n\) representing the number of elements in the list. The second line contains \(n\) space-separated integers.
outputFormat
Output the non-negative integers from the list in one line, separated by a single space. If there are no non-negative integers, output an empty line.
## sample5
1 2 3 4 5
1 2 3 4 5
</p>