#include <iostream>
int main()
{
std::ios::sync_with_stdio(false);
int bit[2][26] = { 0 };
int baj[2][26] = { 0 };
int n;
std::cin >> n;
for (int i = 0; i < n; ++i) {
char c;
std::cin >> c;
++bit[i & 1][c - 'a'];
}
for (int i = 0; i < n; ++i) {
char c;
std::cin >> c;
++baj[i & 1][c - 'a'];
}
bool yes = true;
for (int j = 0; j < 2; ++j) {
for (int i = 0; i < 26; ++i) {
yes &= (bit[j][i] == baj[j][i]);
}
}
std::cout << (yes ? "TAK" : "NIE") << std::endl;
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 33 34 | #include <iostream> int main() { std::ios::sync_with_stdio(false); int bit[2][26] = { 0 }; int baj[2][26] = { 0 }; int n; std::cin >> n; for (int i = 0; i < n; ++i) { char c; std::cin >> c; ++bit[i & 1][c - 'a']; } for (int i = 0; i < n; ++i) { char c; std::cin >> c; ++baj[i & 1][c - 'a']; } bool yes = true; for (int j = 0; j < 2; ++j) { for (int i = 0; i < 26; ++i) { yes &= (bit[j][i] == baj[j][i]); } } std::cout << (yes ? "TAK" : "NIE") << std::endl; return 0; } |
English