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
55
56
57
58
59
60
61
62
63
64
65
66
/*
 * zab.cpp
 *
 *  Created on: 9 Dec 2020
 *      Author: Bartek
 */
#include <iostream>

 //2*10000000
#define MAXSIZE 2000000
#define YELLOW 1
#define BLUE 2
#define RED 3


int main()
{
    //std::ios::sync_with_stdio(false);

    int cntOdd1[26], cntEven1[26];
    int cntOdd2[26], cntEven2[26];
    std::fill_n(cntOdd1, 26, 0);
    std::fill_n(cntEven1, 26, 0);
    std::fill_n(cntOdd2, 26, 0);
    std::fill_n(cntEven2, 26, 0);

    int n;
    char c;

    std::cin >> n;

    bool even = true;
    for (int i = 0; i < n; i++)
    {
        std::cin >> c;
        if(even)
            cntEven1[c - 'a']++;
        else
            cntOdd1[c - 'a']++;
        even = !even;
    }

    even = true;

    for (int i = 0; i < n; i++)
    {
        std::cin >> c;
        if (even)
            cntEven2[c - 'a']++;
        else
            cntOdd2[c - 'a']++;
        even = !even;
    }

    bool equal = true;

    for (int i = 0; i < 26; i++)
        if (cntEven1[i] != cntEven2[i]) equal = false;

    for (int i = 0; i < 26; i++)
        if (cntOdd1[i] != cntOdd2[i]) equal = false;

    std::cout << (equal ? "TAK" : "NIE");

    return 0;
}