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

int main () {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;

    string s1, s2;
    cin >> s1;
    cin >> s2;

    vector <int> parzyste(26, 0);
    vector <int> nieparzyste(26, 0);

    for (int i=0;i<n;i++) {
        if (i%2==0)
            parzyste[s2[i]-'a']++;
        else
            nieparzyste[s2[i]-'a']++;
    }

    for (int i=0;i<n;i++) {
        if (i%2==0) {
            parzyste[s1[i]-'a']--;
            if (parzyste[s1[i]-'a'] < 0) {
                cout << "NIE\n";
                return 0;
            }
        }
        else {
            nieparzyste[s1[i]-'a']--;
            if (nieparzyste[s1[i]-'a'] < 0) {
                cout << "NIE\n";
                return 0;
            }
        }
    }

    cout << "TAK\n";

    return 0;
}