1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <bits/stdc++.h>
using namespace std;
int n, b[2], s;
char c;
int main()
{
    scanf("%d", &n);
    b[1] = -n * 2;
    n *= 8;
    for (int i = 0; i < n; i++)
    {
        cin >> c;
        ++b[c - 48];
    }
    n /= 8;
    if(b[1] < n || b[1] > 4 * n)
    {
        printf("NIE");
        return 0;
    }
    for (int i = 1; i <= n; i++)
    {
        if(b[1] - 4 >= n - i)
        {
            printf("o");
            b[1] -= 4;
            continue;
        }
        if(b[1] - 3 == n - i)
        {
            printf("z");
            b[1] -= 3;
            continue;
        }
        if(b[1] - 2 == n - i)
        {
            printf("x");
            b[1] -= 2;
            continue;
        }
        --b[1];
        printf("a");
    }
}