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

bool parz[2][26];
int zliczparz[2][52];

int main(){
int n;
string a,b;
cin>>n;
cin>>a;
cin>>b;
for(int i=0;i<n;i++){
    if(i%2==1){
        parz[0][a[i]-'a']=1;
        parz[1][b[i]-'a']=1;
        zliczparz[0][a[i]-'a']++;
        zliczparz[1][b[i]-'a']++;
    }else{
        zliczparz[0][a[i]-'a'+26]++;
        zliczparz[1][b[i]-'a'+26]++;
    }
}
for(int i=0;i<26;i++){
    if(parz[0][i]!=parz[1][i] or zliczparz[0][i]!=zliczparz[1][i] or zliczparz[0][i+26]!=zliczparz[1][i+26]){
        cout<<"NIE";
        return 0;
    }
}
cout<<"TAK";
return 0;
}