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

using namespace std;

char s1[300010];
char s2[300010];
int count1_odd[30]={0};
int count1_even[30]={0};
int count2_odd[30]={0};
int count2_even[30]={0};


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

    cin.getline(s1, n+1);
    for (int i=0; i<n; i+=2) count1_odd[s1[i]-'a']++;
    for (int i=1; i<n; i+=2) count1_even[s1[i]-'a']++;

    cin.getline(s2, n+1);
    for (int i=0; i<n; i+=2) count2_odd[s2[i]-'a']++;
    for (int i=1; i<n; i+=2) count2_even[s2[i]-'a']++;

    for (int i=0; i<30; ++i) {
        //cout<<i<<". "<<count1_odd[i]<<" "<<count2_odd[i]<<" "<<count1_even[i]<<" "<<count2_even[i]<<endl;
        if (count1_odd[i]!=count2_odd[i] || count1_even[i]!=count2_even[i]) {
            cout<<"NIE"<<endl;
            return 0;
        }
    }

    cout<<"TAK"<<endl;
    return 0;
}