#include <iostream> using namespace std; int ba[2][100]; int bi[2][100]; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; char c; for (int i = 0; i < n; i++) { cin >> c; ba[i % 2][c - 'a']++; } for (int i = 0; i < n; i++) { cin >> c; bi[i % 2][c - 'a']++; } bool good = true; for (int i = 0; i < 2; i++) { for (int j = 0; j < 26; j++) { if (ba[i][j] != bi[i][j]) { good = false; } } } cout << (good ? "TAK\n" : "NIE\n"); }
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 | #include <iostream> using namespace std; int ba[2][100]; int bi[2][100]; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; char c; for (int i = 0; i < n; i++) { cin >> c; ba[i % 2][c - 'a']++; } for (int i = 0; i < n; i++) { cin >> c; bi[i % 2][c - 'a']++; } bool good = true; for (int i = 0; i < 2; i++) { for (int j = 0; j < 26; j++) { if (ba[i][j] != bi[i][j]) { good = false; } } } cout << (good ? "TAK\n" : "NIE\n"); } |