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
#include <iostream>
#include <string>
using namespace std;
int main()
{
    int t;
    string bitek,bartek;
    int  biteknp[30] = {}, bitekp[30] = {}, barteknp[30] = {}, bartekp[30] = {};
    
    bool flag = 0;
    cin >> t; 
    cin >> bitek >> bartek;
    for (int i = 0; i<bitek.size(); i++)
    {
        char bit = bitek[i], bar = bartek[i];
        int z =(int)( bit - 'a');
        int q = (int)(bar - 'a');
        if (i % 2 == 0) //np
        {
            biteknp[z]++;
            barteknp[q]++;
        }
        else //p
        {
            bitekp[z]++;
            bartekp[q]++;
        }
    }

    for (int i = 1; i < 26; i++)
    {
        if (bitekp[i] != bartekp[i] || biteknp[i] != barteknp[i])
            flag = 1;
    }
    if (flag == 1) cout << "NIE";
    else cout << "TAK";
    return 0;
}