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
#include <iostream>
#include <string>
#include <unordered_map>

int main() {
    int n, bit_1, a, x;
    std::string s;
    std::string left, right;
    char* data;
    std::unordered_map<int, char> dict_int_to_char = {{3, 'b'}, {4, 'e'}, {5, 'z'}, {6, 'o'}};

    std::cin >> n;
    std::cin >> s;

    data = s.data();
    bit_1 = 0;
    while(*data) {
        if(*data == '1') {
            bit_1++;
        }
        data++;
    }
    if(bit_1 < n*3 || n*6 < bit_1) {
        left = "NIE";
    } else {
        a = bit_1/n;
        x = n*(a+1) - bit_1;
        left.assign(x, dict_int_to_char[a]);
        right.assign(n-x, dict_int_to_char[a+1]);
    }
    std::cout << left << right << std::endl;
    return 0;
}