Separated sort

Given a sequence of natural numbers, first, print the even numbers in
increasing order, and then the odd numbers in decreasing order.

Input

Input consists of zero or more cases. Each case consists of a line with
at most 1000 natural numbers strictly positive. Each line ends with a 0
that indicates the end.

Output

For each case, print in a line the even numbers in increasing order, and
in the following line the odd numbers in decreasing order.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T10:27:20.460Z

© Jutge.org, 2006–2026.
https://jutge.org
