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 <bits/stdc++.h>
using namespace std;

int bitus[2]['z' - 'a' + 1];
int bajtus[2]['z' - 'a' + 1];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    string s1, s2;
    int smiec;
    cin >> smiec;
    cin >> s1 >> s2;
    for(int i = 0; i < s1.size(); i++)
    {
        if(i % 2 == 0)
        {
            bitus[0][s1[i] - 'a']++;
            bajtus[0][s2[i] - 'a']++;
        }
        else
        {
            bitus[1][s1[i] - 'a']++;
            bajtus[1][s2[i] - 'a']++;
        }
    }

    bool prawda = true;

    for(int i = 0; i < 'z' - 'a' + 1; i++)
    {
        if((bitus[0][i] != bajtus[0][i]) ||(bitus[1][i] != bajtus[1][i])) prawda = false;
    }
    if(prawda) cout << "TAK";
    else cout << "NIE";
}