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
#include<iostream>
#include<string>
using namespace std;
int symbols1[26];
int symbols2[26];
int symbols3[26];
int symbols4[26];
int main()
{
    string napis1, napis2;
    int n;
    cin >> n;
    cin >> napis1;
    cin >> napis2;
    for(int i = 0; i < n; i+=2)
    {
        symbols1[napis1[i]-97]+=1;
        symbols2[napis2[i]-97]+=1;
    }
    for(int i = 1; i < n; i+=2)
    {
        symbols3[napis1[i]-97]+=1;
        symbols4[napis2[i]-97]+=1;
    }
    bool check = true;
    for(int i = 0; i < 26; i++)
    {
        if(symbols1[i]!=symbols2[i])
        {
            check = false;
            break;
        }
        if(symbols3[i]!=symbols4[i])
        {
            check = false;
            break;
        }
    }
    if(check)
        cout << "TAK";
    else
        cout << "NIE";
}