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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include <iostream>
#include <vector>

#include <stdio.h>

using namespace std;

int main()
{
    //chrono::high_resolution_clock::time_point t1 = chrono::high_resolution_clock::now();
    ios_base::sync_with_stdio(false);  // wylaczamy synchronizacje strumieni (patrz ponizej)
    cin.tie(0);

    int iloscZabawek = 0;

    fscanf(stdin, "%d\n", &iloscZabawek);

    vector <int> zabawkiBitusia_n(26,0);
    vector <int> zabawkiBitusia_p(26,0);
    vector <int> zabawkiBajtusia_n(26,0);
    vector <int> zabawkiBajtusia_p(26,0);

    char temp_char;
    int temp_int;

    for (int i = 0; i < iloscZabawek; i++) {
        fscanf(stdin, "%c", &temp_char);
        temp_int = (int)(temp_char - 97);
        if (i % 2)
            zabawkiBitusia_n[temp_int]++;
        else
            zabawkiBitusia_p[temp_int]++;
    };
    fscanf(stdin,"\n");

    for (int i = 0; i < iloscZabawek; i++) {
        fscanf(stdin, "%c", &temp_char);
        temp_int = (int)(temp_char - 97);
        if (i % 2)
            zabawkiBajtusia_n[temp_int]++;
        else
            zabawkiBajtusia_p[temp_int]++;
    };
    
    /*for (int i = 0; i < 26; i++) {
        cout << zabawkiBitusia_n[i] << ",";
    };
    cout << "\n";

    for (int i = 0; i < 26; i++) {
        cout << zabawkiBajtusia_n[i] << ",";
    };
    cout << "\n";
    cout << "\n";

    for (int i = 0; i < 26; i++) {
        cout << zabawkiBitusia_p[i] << ",";
    };
    cout << "\n";

    for (int i = 0; i < 26; i++) {
        cout << zabawkiBajtusia_p[i] << ",";
    };
    cout << "\n";*/

    for (int i = 0; i < 26; i++) {
        if (zabawkiBitusia_n[i] != zabawkiBajtusia_n[i]) {
            cout << "NIE";
            return 0;
        }
        if (zabawkiBitusia_p[i] != zabawkiBajtusia_p[i]) {
            cout << "NIE";
            return 0;
        }
    }

    cout << "TAK";

    return 0;
}