Use stacks to reverse sequences of integer numbers. Print first the even numbers in reverse order, and afterwards the odd numbers in reverse order.
Input
Input consists of several sequences of integer numbers, one per line.
Output
For every line, print the even numbers in reverse order, followed by the odd numbers in reverse order, all them separated by spaces.
Observation
To solve this exercise, the only containers that you should use are stacks.
Input
0 1 2 3 4 5 6 7 10 10 20 10 3 15 7 11 -1 -2 -3 -4
Output
6 4 2 0 7 5 3 1 10 20 10 10 11 7 15 3 -4 -2 -3 -1