#include <cstdio> #include <array> #include <vector> #include <algorithm> const int N = 3e5 + 10; char s[N], t[N]; int main() { int n; scanf("%d%s%s", &n, s, t); std::vector<std::array<int, 26>> a(2), b(2); for (int i = 0; i < n; ++i) { a[i & 1][s[i] - 'a']++; b[i & 1][t[i] - 'a']++; } if (a[0] == b[0] && a[1] == b[1]) puts("TAK"); else puts("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 <cstdio> #include <array> #include <vector> #include <algorithm> const int N = 3e5 + 10; char s[N], t[N]; int main() { int n; scanf("%d%s%s", &n, s, t); std::vector<std::array<int, 26>> a(2), b(2); for (int i = 0; i < n; ++i) { a[i & 1][s[i] - 'a']++; b[i & 1][t[i] - 'a']++; } if (a[0] == b[0] && a[1] == b[1]) puts("TAK"); else puts("NIE"); return 0; } |