#K71252. Separate Even and Odd Numbers
Separate Even and Odd Numbers
Separate Even and Odd Numbers
You are given a single line of input containing a series of integers separated by spaces. Your task is to separate these integers into two groups:
- Even numbers, which should be output on the first line in the same order as they appear.
- Odd numbers, which should be output on the second line in the same order as they appear.
If there are no even or odd numbers, output an empty line for that group. Use the standard input and output streams for reading data and printing your result.
Note: The solution must read from standard input (stdin) and output to standard output (stdout).
inputFormat
A single line containing space-separated integers.
outputFormat
Two lines of output. The first line contains the even numbers separated by spaces and the second line contains the odd numbers separated by spaces. If a group is empty, output an empty line for that group.## sample
1 2 3 4 5 6
2 4 6
1 3 5
</p>