#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); vector <int> arr1 (26, 0); vector <int> arr2 (26, 0); string a, b; cin >> a >> a >> b; for (int i = 0; i < a.size(); i += 2) { arr1[a[i] - 'a']++; arr1[b[i] - 'a']--; } for (int i = 1; i < a.size(); i += 2) { arr2[a[i] - 'a']++; arr2[b[i] - 'a']--; } for (auto d : arr1) if (d != 0) { cout << "NIE"; return 0; } for (auto d : arr2) if (d != 0) { cout << "NIE"; return 0; } cout << "TAK"; }
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 | #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); vector <int> arr1 (26, 0); vector <int> arr2 (26, 0); string a, b; cin >> a >> a >> b; for (int i = 0; i < a.size(); i += 2) { arr1[a[i] - 'a']++; arr1[b[i] - 'a']--; } for (int i = 1; i < a.size(); i += 2) { arr2[a[i] - 'a']++; arr2[b[i] - 'a']--; } for (auto d : arr1) if (d != 0) { cout << "NIE"; return 0; } for (auto d : arr2) if (d != 0) { cout << "NIE"; return 0; } cout << "TAK"; } |