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

using namespace std;

int main()
{
    int n;
    cin >> n;
    string a, b;
    int ac[26], bc[26], ac1[26], bc1[26];
    for (int i = 0; i < 26; i++)
    {
        ac[i] = 0;
        bc[i] = 0;
        ac1[i] = 0;
        bc1[i] = 0;
    }
    cin >> a >> b;
    for (int i = 0; i < n; i += 2)
    {
        ac[(int)a[i] - 97]++;
        bc[(int)b[i] - 97]++;
    }
    for (int i = 1; i < n; i += 2)
    {
        ac1[(int)a[i] - 97]++;
        bc1[(int)b[i] - 97]++;
    }
    for (int i = 0; i < n; i ++)
    {
        if (ac[i] != bc[i])
        {
            cout << "NIE" << endl;
            return 0;
        }
        if (ac1[i] != bc1[i])
        {
            cout << "NIE" <<endl;
            return 0;
        }
    }
    cout << "TAK" <<endl;
        return 0;
    }