#include <iostream> using namespace std; int bi[2][26],ba[2][26]; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; string sbi,sba; cin >> sbi >> sba; for (int i=0;i<n;i++) { bi[i%2][sbi[i]-'a']++; ba[i%2][sba[i]-'a']++; } bool ok = true; for (int i=0;ok && i<26; i++) ok = bi[0][i]==ba[0][i] && bi[1][i]==ba[1][i]; cout << (ok ? "TAK" : "NIE"); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <iostream> using namespace std; int bi[2][26],ba[2][26]; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; string sbi,sba; cin >> sbi >> sba; for (int i=0;i<n;i++) { bi[i%2][sbi[i]-'a']++; ba[i%2][sba[i]-'a']++; } bool ok = true; for (int i=0;ok && i<26; i++) ok = bi[0][i]==ba[0][i] && bi[1][i]==ba[1][i]; cout << (ok ? "TAK" : "NIE"); return 0; } |