#K566. Sorted Squares of Non-negative Integers
Sorted Squares of Non-negative Integers
Sorted Squares of Non-negative Integers
You are given a list of integers. Your task is to compute the square of each non-negative integer from the list and output these squares in non-decreasing (sorted) order.
Note: Negative numbers should be ignored. If no non-negative numbers exist in the input, output an empty line.
The input is provided via standard input (stdin) and the output should be printed to standard output (stdout). The first line of input contains an integer n (the number of elements). The second line contains n space-separated integers.
Example:
Input: 5 -4 -2 0 3 5</p>Output: 0 9 25
inputFormat
The first line contains a single integer n, the number of integers in the list. The second line contains n space-separated integers.
outputFormat
Output a single line containing the squares of all non-negative integers from the input, sorted in non-decreasing order and separated by spaces. If there are no non-negative integers, output an empty line.
## sample5
-4 -2 0 3 5
0 9 25
</p>