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
46
47
48
49
50
51
52
53
54
#include <iostream>
using namespace std;

int ile;
string fraza1,fraza2;
int parz[40];
int nieparz[40];
int parz2[40];
int nieparz2[40];

int main()
{
    cin>>ile>>fraza1>>fraza2;

    for(int i=0; i<=30; i++)
    {
        parz[i]=0;
        nieparz[i]=0;
    }

    for(int i=0; i<ile; i=i+2)
    {
        parz[fraza1[i]-'a']++;
    }
    for(int i=1; i<ile; i=i+2)
    {
        nieparz[fraza1[i]-'a']++;
    }


    for(int i=0; i<ile; i=i+2)
    {
        parz2[fraza2[i]-'a']++;
    }
    for(int i=1; i<ile; i=i+2)
    {
        nieparz2[fraza2[i]-'a']++;
    }

    for(int i=0; i<=30; i++)
    {
        if(parz[i]!=parz2[i])
        {
            cout<<"NIE";
            return 0;
        }
        if(nieparz[i]!=nieparz2[i])
        {
            cout<<"NIE";
            return 0;
        }
    }
    cout<<"TAK";
}