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
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    string s1;
    string s2;
    cin>>s1>>s2;
    vector<int>even1(26,0);
    vector<int>odd1(26,0);
    vector<int>even2(26,0);
    vector<int>odd2(26,0);
    for(int i=0;i<n;i+=2){
        odd1[s1[i]-97]+=1;
        odd2[s2[i]-97]+=1;
    }
    for(int i=1;i<n;i+=2){
        even1[s1[i]-97]+=1;
        even2[s2[i]-97]+=1;
    }
    if(even1==even2&&odd1==odd2){
        cout<<"TAK";
    }
    else{cout<<"NIE";}
}