#include<bits/stdc++.h> using namespace std; int t1[26], t2[26], t3[26], t4[26], n; string s1, s2; int main() { cin>>n>>s1>>s2; for(int i=0;i<n;i++) { if(i%2==0) { t1[s1[i]-97]++; t2[s2[i]-97]++; } else { t3[s1[i]-97]++; t4[s2[i]-97]++; } } for(int i=0;i<26;i++) { if(t1[i]!=t2[i]||t3[i]!=t4[i]) { cout<<"NIE"; exit(0); } } 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 | #include<bits/stdc++.h> using namespace std; int t1[26], t2[26], t3[26], t4[26], n; string s1, s2; int main() { cin>>n>>s1>>s2; for(int i=0;i<n;i++) { if(i%2==0) { t1[s1[i]-97]++; t2[s2[i]-97]++; } else { t3[s1[i]-97]++; t4[s2[i]-97]++; } } for(int i=0;i<26;i++) { if(t1[i]!=t2[i]||t3[i]!=t4[i]) { cout<<"NIE"; exit(0); } } cout<<"TAK"; return 0; } |