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
45
#include<iostream>
using namespace std;

int tab1[26];
int tab2[26];
int tab3[26];
int tab4[26];

int main()
{
    string s1, s2, sp1, sp2, sn1, sn2;
    bool czy1 = true;
    int ile;
    cin >> ile;
    cin >> s1 >> s2;

    for (int i = 0; i < ile; i+=2)
    {
        tab1[s1[i] - 'a']++;
        tab2[s2[i] - 'a']++;
    }

    for (int i = 1; i < ile; i+=2)
    {
        tab3[s1[i] - 'a']++;
        tab4[s2[i] - 'a']++;
    }

    for (int i = 0; i < 26; i++)
    {
        if (tab1[i] != tab2[i])
            czy1 = false;
    }

    for (int i = 0; i < 26; i++)
    {
        if (tab3[i] != tab4[i])
            czy1 = false;
    }

    if (czy1)
        cout << "TAK" << endl;
    else
        cout << "NIE" << endl;
}