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


std::array<int, 26> first_p = {0};
std::array<int, 26> first_o = {0};

std::array<int, 26> second_p = {0};
std::array<int, 26> second_o = {0};


int main(){
    int n;
    std::string a, b;
    std::cin >> n >> a >> b;

    for(int x=0; x<a.size(); x++){
        int c = (int)a[x] - (int)'a';
        if(x % 2 == 0){
            first_p[c]++;
        } else {
            first_o[c]++;
        }
    }
    for(int x=0; x<b.size(); x++){
        int c = (int)b[x] - (int)'a';
        if(x % 2 == 0){
            second_p[c]++;
        } else {
            second_o[c]++;
        }
    }

    if(first_p == second_p && first_o == second_o){
        std::cout << "TAK" << std::endl;
    } else {
        std::cout << "NIE" << std::endl;
    }
}