#include<bits/stdc++.h> using namespace std; string aa[2],bb[2]; int32_t main(){ ios::sync_with_stdio(false); int n; cin >> n; string a,b; cin >> a >> b; for(int i=0;i<n;i++) { aa[i%2] += a[i]; bb[i%2] += b[i]; } for(int i=0;i<2;i++) { sort(aa[i].begin(),aa[i].end()); sort(bb[i].begin(),bb[i].end()); } if(aa[0] == bb[0] && aa[1] == bb[1]) cout<<"TAK\n"; else cout<<"NIE\n"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include<bits/stdc++.h> using namespace std; string aa[2],bb[2]; int32_t main(){ ios::sync_with_stdio(false); int n; cin >> n; string a,b; cin >> a >> b; for(int i=0;i<n;i++) { aa[i%2] += a[i]; bb[i%2] += b[i]; } for(int i=0;i<2;i++) { sort(aa[i].begin(),aa[i].end()); sort(bb[i].begin(),bb[i].end()); } if(aa[0] == bb[0] && aa[1] == bb[1]) cout<<"TAK\n"; else cout<<"NIE\n"; } |