#include <bits/stdc++.h>
using namespace std;
int tabpp[300007];
int tabnpp[300007];
int tabpd[300007];
int tabnpd[300007];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;cin>>n;
string s,s1;cin>>s>>s1;
int k=0,g=0;
for(int i=0;i<n;i++)
{
if(i%2==0){
tabpp[s[i]-'a']++;
tabpd[s1[i]-'a']++;
}
else
{
tabnpp[s[i]-'a']++;
tabnpd[s1[i]-'a']++;
}
}
bool flaga=false;
for(int i=0;i<26;i++)
{
if(tabpp[i]!=tabpd[i] or tabnpp[i]!=tabnpd[i]) flaga=true;
}
if(flaga) cout<<"NIE";
else cout<<"TAK";
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 tabpp[300007]; int tabnpp[300007]; int tabpd[300007]; int tabnpd[300007]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n;cin>>n; string s,s1;cin>>s>>s1; int k=0,g=0; for(int i=0;i<n;i++) { if(i%2==0){ tabpp[s[i]-'a']++; tabpd[s1[i]-'a']++; } else { tabnpp[s[i]-'a']++; tabnpd[s1[i]-'a']++; } } bool flaga=false; for(int i=0;i<26;i++) { if(tabpp[i]!=tabpd[i] or tabnpp[i]!=tabnpd[i]) flaga=true; } if(flaga) cout<<"NIE"; else cout<<"TAK"; return 0; } |
English