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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <sstream>
#include <vector>
#include <iostream>
using namespace std;
/*

8
1011111010101100011011011010001010100011111111110001001001011010

 8
1011111010101100011011011010001010100011111111110001001001011011

 8
1011111010101100011011011010001010100011111111110101001001011011

 8
1011111111101111111011011010001010111111111111110101001111011011

  8
1011111111101111111011011010001010111111111111110101001111111011

 */
int main() {
    int n, i;
    cin >> n;
    int bits = n * 8;
    string str;
    cin >> str;

    int ones = 0;
    for(i = 0; i < bits ; i++) {
        if(str[i] == '1') {
            ++ones;
        }
    }
    char result[n] ;
    int resultIndex = 0;
    if(3 * n <= ones && ones < 4 * n) {
        int smallerLetter = 4 * n - ones;
        for(i = 0; i < smallerLetter; i++) {
            result[resultIndex++]  = 'a';
        }
        for(i = 0; i < n - smallerLetter; i++) {
            result[resultIndex++]  = 'c';
        }
    } else if(4 * n <= ones && ones < 5 * n) {
        int smallerLetter = 5 * n - ones;
        for(i = 0; i < smallerLetter; i++) {
            result[resultIndex++]  = 'c';
        }
        for(i = 0; i < n - smallerLetter; i++) {
            result[resultIndex++]  = 'g';
        }
    } else if(5 * n <= ones && ones <= 6 * n) {
        int smallerLetter = 6 * n - ones;
        for(i = 0; i < smallerLetter; i++) {
            result[resultIndex++]  = 'g';
        }
        for(i = 0; i < n - smallerLetter; i++) {
            result[resultIndex++]  = 'w';
        }
    } else {
        std::cout << "NIE" << std::endl;
        return 0;
    }
    string s(result, n);
    std::cout << s << std::endl;
    return 0;
}