#C4738. Sort Positive Numbers with Maintained Order
Sort Positive Numbers with Maintained Order
Sort Positive Numbers with Maintained Order
You are given a list of integers. Your task is to sort only the positive numbers in ascending order, while keeping the relative order of the non-positive numbers (zero and negative numbers) unchanged. This means that when you output the list, every positive number appears in its corresponding position where a positive number existed in the original list, but in sorted order. The non-positive numbers must remain in their original positions.
Note: The input is received from standard input and the result should be printed to standard output.
For example, given the list:
3 -2 -1 5 0 -4 2 8 -3
The output should be:
2 -2 -1 3 0 -4 5 8 -3
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
Print the modified list as a sequence of space-separated integers on one line.
## sample9
3 -2 -1 5 0 -4 2 8 -3
2 -2 -1 3 0 -4 5 8 -3
</p>