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 <stdio.h>
#include <stdlib.h>

int main()
{
char *A,*B;
int a,b,n,N,lA[2][26],lB[2][26],ret;

	scanf("%d",&N);
	A = (char*) malloc((N+1)*sizeof(char));
	B = (char*) malloc((N+1)*sizeof(char));
	
	scanf("%s",A);
	scanf("%s",B);
	
	for (n = 0; n < 26; n++)
	{
		lA[0][n] = 0;
		lA[1][n] = 0;
		lB[0][n] = 0;
		lB[1][n] = 0;
	}
	
	for (n = 0; n < N; n++)
	{
		lA[n&1][A[n]-'a']++;
		lB[n&1][B[n]-'a']++;
	}
	ret = 1;
	for (n = 0; n < 26; n++)
	{
		if (lA[0][n] != lB[0][n]) ret = 0;
		if (lA[1][n] != lB[1][n]) ret = 0;
	}
	printf("%s\n",(ret==0)?"NIE":"TAK");
	
	free(A);
	free(B);
	
	return 0;
}