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
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

char s[4000010];

int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", s);

  int zeros = 0;
  int ones = 0;

  for (int i = 0; i < 8*n; ++i) {
    if (s[i] == '0') zeros++;
    if (s[i] == '1') ones++;
  }
  if (ones < 3*n || ones > 6*n) {
    printf("NIE\n");
    return 0;
  }
  int c = ones / n;
  int d = ones % n;
  char chars[] = "acgo";
  for (int i = 0; i < d; ++i) {
    printf("%c", chars[c-2]);
  }
  for (int i = 0; i < n-d; ++i) {
    printf("%c", chars[c-3]);
  }
  printf("\n");
}