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

using namespace std;

int parza [26][2];
int parzb [26][2];

int main()
{
    int il;
    cin >> il;
    char a;
    getchar();
    bool czy = 1;
    for (int q = 0; q < il; q++){
        a = getchar();
        //cout << a << '\n';
        a -= 'a';
        parza[a][q%2]++;
    }
    getchar();
    for (int q = 0; q < il; q++){
        a = getchar();
        //cout << a << '\n';
        a -= 'a';
        parzb[a][q%2]++;
    }
    for (int q = 0; q < 26; q++){
        if (parza[q][0] != parzb[q][0]) czy = 0;
        if (parza[q][1] != parzb[q][1]) czy = 0;
    }
    if (czy){
        cout << "TAK";
        return 0;
    }
    cout << "NIE";
}