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

using namespace std;
char a,b;
int n,c;
int t11[30];
int t12[30];
int t21[30];
int t22[30];
int main()
{
    std::ios_base::sync_with_stdio(0);
    cin>>n;
    for(int i=0;i<n/2;i++)
    {
        cin>>a>>b;
        t11[(int)a-97]++;
        t12[(int)b-97]++;
    }

    if(n%2!=0)
    {
        cin>>a;
        t11[(int)a-97]++;
    }
    for(int i=0;i<n/2;i++)
    {
        cin>>a>>b;
        t21[(int)a-97]++;
        t22[(int)b-97]++;
    }

    if(n%2!=0)
    {
        cin>>a;
        t21[(int)a-97]++;
    }
    for(int i=0;i<27;i++)
    {
        if(t11[i]!=t21[i]){cout<<"NIE";return 0;}
        if(t12[i]!=t22[i]){cout<<"NIE";return 0;}
    }
    cout<<"TAK";
    return 0;
}