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
#include <iostream>
#include <algorithm>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main() {
	long ile = 0;
	int n;
	char tmp[9000000];
    char q[5] = {'z','a','c','g','o'};
	scanf("%d", &n);
	scanf("%s",&tmp);
//	s=tmp;
	
	for(int i=0;i<8*n;i++){
		if(tmp[i]=='1')ile++;
	}
//	printf("ile = %d",ile);
	if((ile-(2*n))<=0){
		printf("NIE");
	}else{
		ile-=(2*n);
	//	printf("ile = %d",ile);
		if(ile<n || ile>4*n){
			printf("NIE");
		}else{
			int a=ile%n;//4
			int b=ile/n;//2
			for(int i=0;i<a;i++){
				printf("%c",q[b+1]);
			}
			for(int i=0;i<n-a;i++){
				printf("%c",q[b]);
			}
			
		}
	}

	
  
	return 0;
}