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
#include <bits/stdc++.h>
using namespace std;
#define h 28
int s1_np[h], s1_p[h], s2_np[h], s2_p[h];
int i_z_char(char a) //zwraca od 1 do 26
{
    int r=a-96; return r;
}
int main()
{
   ios_base::sync_with_stdio(0);
   int n; cin>>n;
   string s1, s2; cin>>s1>>s2;
   for (int i=0;i<n;i++)
   {
       char a=s1[i], b=s2[i];
       if (i%2==0) s1_np[ i_z_char(a) ]++;
       else s1_p[ i_z_char(a) ]++;
   }
   for (int i=0;i<n;i++)
   {
       int kt_wym=i_z_char(s2[i]);
       if (i%2==0) //mod 0 to nieparzyste
       {
           if (s1_np[kt_wym])  s1_np[kt_wym]--;
           else { cout<<"NIE"; return 0; }
       }
       else
       {
           if (s1_p[kt_wym])  s1_p[kt_wym]--;
           else { cout<<"NIE"; return 0; }
       }
   }
   cout<<"TAK";







  return 0;
}