#include <bits/stdc++.h>
using namespace std;
int t1[26];
int t2[26];
int main(){
char c='b';
int n=0;
while(c<'0'||c>'9')c=getchar();
while(c>='0'&&c<='9'){
n*=10;
n+=c-48;
c=getchar();
}
string s;
for (int i = 0; i < n; ++i){
c=getchar();
if(i%2)++t1[c-'a'];
else ++t2[c-'a'];
}
c=getchar();
for (int i = 0; i < n; ++i){
c=getchar();
if(i%2)--t1[c-'a'];
else --t2[c-'a'];
}
//for(int i = 0; i < 26; ++i)cout<<t[i]<<" ";cout<<"\n";
for (int i = 0; i < 26; ++i)if(t1[i]!=0||t2[i]!=0){cout<<"NIE\n";return 0;}
cout <<"TAK\n";
return 0;
}
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 | #include <bits/stdc++.h> using namespace std; int t1[26]; int t2[26]; int main(){ char c='b'; int n=0; while(c<'0'||c>'9')c=getchar(); while(c>='0'&&c<='9'){ n*=10; n+=c-48; c=getchar(); } string s; for (int i = 0; i < n; ++i){ c=getchar(); if(i%2)++t1[c-'a']; else ++t2[c-'a']; } c=getchar(); for (int i = 0; i < n; ++i){ c=getchar(); if(i%2)--t1[c-'a']; else --t2[c-'a']; } //for(int i = 0; i < 26; ++i)cout<<t[i]<<" ";cout<<"\n"; for (int i = 0; i < 26; ++i)if(t1[i]!=0||t2[i]!=0){cout<<"NIE\n";return 0;} cout <<"TAK\n"; return 0; } |
English