## Algorithm

Problem Name: beecrowd | 1179

# Array Fill IV

Adapted by Neilor Tonin, URI Brazil

Timelimit: 1

In this problem you need to read 15 numbers and must put them into two different arrays: par if the number is even or impar if this number is odd. But  the size of each of the two arrrays is only 5 positions. So every time you fill one of two arrays, you must print the entire array to be able to use it again for the next numbers that are read. At the end, all remaining numbers of each one of these two arrays must be printed beggining with the odd array. Each array can be filled how many times are necessary.

## Input

The input contains 15 integer numbers.

## Output

Print the output like the following example.

 Input Sample Output Sample 1 3 4 -4 2 3 8 2 5 -7 54 76 789 23 98 par[0] = 4 par[1] = -4 par[2] = 2 par[3] = 8 par[4] = 2 impar[0] = 1 impar[1] = 3 impar[2] = 3 impar[3] = 5 impar[4] = -7 impar[0] = 789 impar[1] = 23 par[0] = 54 par[1] = 76 par[2] = 98

## Code Examples

### #1 Code Example with C++ Programming

```Code - C++ Programming```

``````
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
int a1[5],a2[5];
int count1 = 0,count2 = 0,num;
for(int i = 0; i  <  15; i++)
{
cin >> num;
if(num%2 == 0)
{
a1[count1] = num;
count1++;
}
if(num%2!=0)
{
a2[count2]=num;
count2++;
}
if(count2==5||i==14)
{
for(int o = 0; o < count2; o++)
{
printf("impar[%d] = %d\n",o,a2[o]);
}
count2=0;
}
if(count1==5||i==14)
{
for(int i = 0; i  <  count1; i++)
{
printf("par[%d] = %d\n",i,a1[i]>;
}
count1=0;
}
}
return 0;
}
``````
Copy The Code &

Input

cmd
1 3 4 -4 2 3 8 2 5 -7 54 76 789 23 98

Output

cmd
par[0] = 4 par[1] = -4 par[2] = 2 par[3] = 8 par[4] = 2 impar[0] = 1 impar[1] = 3 impar[2] = 3 impar[3] = 5 impar[4] = -7 impar[0] = 789 impar[1] = 23 par[0] = 54 par[1] = 76 par[2] = 98

### #2 Code Example with Javascript Programming

```Code - Javascript Programming```

``````
const lines = input.split('\n');
function clear(n){
while(n.length){
n.pop();
}
return n;
}

let par = []; let impar = [];
for(var i = 0; i  <  15; i++){
let n = parseInt(lines.shift());
if(n % 2 !== 0){
impar.push(n);
if(impar.length === 5){
for(var m = 0; m <  5; m++){
console.log(`impar[\${m}] = \${impar[m]}`);
}
clear(impar);
}
}
else{
par.push(n);
if(par.length === 5){
for(var m = 0; m  <  5; m++){
console.log(`par[\${m}] = \${par[m]}`);
}
clear(par);
}
}
}
if(impar.length !== 0){
for(var i = 0; i  <  impar.length; i++){
console.log(`impar[\${i}] = \${impar[i]}`);
}
}
if(par.length !== 0){
for(var i = 0; i  <  par.length; i++){
console.log(`par[\${i}] = \${par[i]}`>;
}
}
``````
Copy The Code &

Input

cmd
1 3 4 -4 2 3 8 2 5 -7 54 76 789 23 98

Output

cmd
par[0] = 4 par[1] = -4 par[2] = 2 par[3] = 8 par[4] = 2 impar[0] = 1 impar[1] = 3 impar[2] = 3 impar[3] = 5 impar[4] = -7 impar[0] = 789 impar[1] = 23 par[0] = 54 par[1] = 76 par[2] = 98

### #3 Code Example with Python Programming

```Code - Python Programming```

``````
par = []; impar = []
for i in range(0, 15):
n = int(input())
if n % 2 != 0:
impar += [n]
if len(impar) == 5:
for m in range(0, 5):
print(f'impar[{m}] = {impar[m]}')
impar.clear()
else:
par += [n]
if len(par) == 5:
for m in range(0, 5):
print(f'par[{m}] = {par[m]}')
par.clear()
if len(impar) != 0:
for i in range(0, len(impar)):
print(f'impar[{i}] = {impar[i]}')
if len(par) != 0:
for i in range(0, len(par)):
print(f'par[{i}] = {par[i]}')
``````
Copy The Code &

Input

cmd
1 3 4 -4 2 3 8 2 5 -7 54 76 789 23 98

Output

cmd
par[0] = 4 par[1] = -4 par[2] = 2 par[3] = 8 par[4] = 2 impar[0] = 1 impar[1] = 3 impar[2] = 3 impar[3] = 5 impar[4] = -7 impar[0] = 789 impar[1] = 23 par[0] = 54 par[1] = 76 par[2] = 98