#include <iostream> using namespace std; int n; string a, b; int cnt[2][128]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> a >> b; for (int i=0; i<n; i++) cnt[i%2][a[i]]++; for (int i=0; i<n; i++) cnt[i%2][b[i]]--; bool fail = false; for (char c='a'; c<='z'; c++) if (cnt[0][c] || cnt[1][c]) fail = true; cout << (fail ? "NIE\n" : "TAK\n"); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include <iostream> using namespace std; int n; string a, b; int cnt[2][128]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> a >> b; for (int i=0; i<n; i++) cnt[i%2][a[i]]++; for (int i=0; i<n; i++) cnt[i%2][b[i]]--; bool fail = false; for (char c='a'; c<='z'; c++) if (cnt[0][c] || cnt[1][c]) fail = true; cout << (fail ? "NIE\n" : "TAK\n"); return 0; } |