#include <iostream> #include <cstring> #define ALPH 26 int C[ALPH]; int main() { std::ios::sync_with_stdio(false); int n; std::string s1, s2; std::cin >> n >> s1 >> s2; for (int k = 0; k < 2; ++k) { for (int i = k; i < n; i += 2) { C[s1[i] - 'a']++; C[s2[i] - 'a']--; } for (int i = 0; i < ALPH; ++i) { if (C[i] != 0) { std::cout << "NIE"; return 0; } } } std::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 | #include <iostream> #include <cstring> #define ALPH 26 int C[ALPH]; int main() { std::ios::sync_with_stdio(false); int n; std::string s1, s2; std::cin >> n >> s1 >> s2; for (int k = 0; k < 2; ++k) { for (int i = k; i < n; i += 2) { C[s1[i] - 'a']++; C[s2[i] - 'a']--; } for (int i = 0; i < ALPH; ++i) { if (C[i] != 0) { std::cout << "NIE"; return 0; } } } std::cout << "TAK"; return 0; } |