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, i, evenToysBit[26]={0}, evenToysBajt[26]={0}, oddToysBit[26]={0}, oddToysBajt[26]={0};
    cin >> n;
    string bit, bajt;
    cin >> bit;
    cin >> bajt;
    bool ok = true;
    for (i = 0; i < n; i += 2)
    {
        evenToysBit[int(bit[i]) - 97]++;
        evenToysBajt[int(bajt[i]) - 97]++;
    }
    for (i = 0; i < 26; i += 2)
    {
        if (evenToysBajt[i] != evenToysBit[i])
        {
            ok = false;
            break;
        }
    }
    if (!ok) cout<<"NIE";
    else
    {
        for (i = 1; i < n; i += 2)
        {
            oddToysBit[int(bit[i]) - 97]++;
            oddToysBajt[int(bajt[i]) - 97]++;
        }
        for (i = 1; i < 26; i += 2)
        {
            if (oddToysBajt[i] != oddToysBit[i])
            {
                ok = false;
                break;
            }
        }
        if (!ok) cout<<"NIE";
        else cout<<"TAK";
    }
    return 0;
}