#include <iostream> using namespace std; int n, w; string f, s; string o="abcdefghijklmnoprstuvwxyz"; int o1[52], o2[52]; int main() {std::ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr); cin>>n; cin>>f; cin>>s; for(int i=0; i<n; i++) {for(int j=0; j<26; j++) {if(f[i]==o[j]) {if(i%2==0) o1[j]+=1; else o1[j+26]++; break; }} for(int y=0; y<26; y++) {if(s[i]==o[y]) {if(i%2==0) o2[y]+=1; else o2[y+26]++; break; }}} for(int a=0; a<52; a++) {if(o1[a]!=o2[a]) {w=1; break;}} if(w==1) 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 36 37 | #include <iostream> using namespace std; int n, w; string f, s; string o="abcdefghijklmnoprstuvwxyz"; int o1[52], o2[52]; int main() {std::ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr); cin>>n; cin>>f; cin>>s; for(int i=0; i<n; i++) {for(int j=0; j<26; j++) {if(f[i]==o[j]) {if(i%2==0) o1[j]+=1; else o1[j+26]++; break; }} for(int y=0; y<26; y++) {if(s[i]==o[y]) {if(i%2==0) o2[y]+=1; else o2[y+26]++; break; }}} for(int a=0; a<52; a++) {if(o1[a]!=o2[a]) {w=1; break;}} if(w==1) cout<<"NIE"; else cout<<"TAK"; return 0; } |