~/algor $ cat problems/array/grouping-even-and-odd-numbers
Grouping even and odd numbers
Easy
1000 ms
128 MB
27%
A positive integer and an array of integers are given. Print first all array elements with even values, then all elements with odd values, in input order.
Input
The first line contains a positive integer . The second line contains integers separated by spaces.
Output
One line with integers separated by spaces (even ones first, then odd ones).
Note
Examples
Input #1
6 4 7 2 9 8 5
Output #1
4 2 8 7 9 5
Input #2
4 1 3 2 4
Output #2
2 4 1 3