#169. 列表非负整数筛选
列表非负整数筛选
Filter Non-Negative Integers
Background
Congcong is organizing his collection of numbers. He has a list of integers but is only interested in those that are non-negative.
Problem Description
Given a list of integers, return a new list containing only the non-negative integers (i.e., integers greater than or equal to ) from the original list, omitting any integers that are less than .
Input Format
The input is given from standard input in the following format.
The input consists of a single line representing a list of integers. The list starts and ends with square brackets
[and], and the integers inside are separated by spaces.
Output Format
The output is printed to standard output in the following format.
The output consists of a single line representing the filtered list of integers. The list starts and ends with square brackets
[and], and the integers inside are separated by a comma and a space,. If the list is empty, output[].
Sample
[1 -2]
[1]
[-3 -3 3 3]
[3, 3]
[-1 -1 -1]
[]
Sample Explanation
For the first sample, the input list is [1 -2]. Here, is a non-negative integer, while is a negative integer. Therefore, the new filtered list is [1].
Constraints
Time limit: second, Memory limit: KiB for each test case.