#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int z, t1[27][2]={0},t2[27][2]={};
string a,b;
cin>>z>>a>>b;
for(int i=1;i<=z;i++)
{
t1[a[i]-96][i%2]++;
t2[b[i]-96][i%2]++;
}
for(int i=1;i<27;i++)
{
if(t1[i][0]!=t2[i][0]||t1[i][1]!=t2[i][1])
{
cout<<"NIE";
return 0;
}
}
cout<<"TAK";
}
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 | #include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int z, t1[27][2]={0},t2[27][2]={}; string a,b; cin>>z>>a>>b; for(int i=1;i<=z;i++) { t1[a[i]-96][i%2]++; t2[b[i]-96][i%2]++; } for(int i=1;i<27;i++) { if(t1[i][0]!=t2[i][0]||t1[i][1]!=t2[i][1]) { cout<<"NIE"; return 0; } } cout<<"TAK"; } |
English