Given a sequence of positive integer numbers, your program must print first the even numbers in increasing order, and then the odd numbers in decreasing order.
The input consists of zero or more cases. Each case consists of a line with at most 10000 integer numbers strictly positive. Each line ends with a 0 that indicates the end.
For each case, your program must print a line with the even numbers in non decreasing order, and in the following line the odd numbers in non increasing order.
Salvador Roura (en: Carlos Molina)
© Jutge.org, 2006–2025.
Input
15 20 0 1 2 3 4 5 6 7 8 0 5 5 5 3 3 3 7 7 7 0
Output
20 15 2 4 6 8 7 5 3 1 7 7 7 5 5 5 3 3 3