#include <bits/stdc++.h> using namespace std; int ile[26][2][2]; int n; int main(){ cin >> n; for (int i = 0; i <= 1; i++) for (int j = 0; j < n; j++){ char x; cin >> x; ile[x-'a'][j%2][i]++; } for (int i = 0; i < 26; i++) if (ile[i][0][0] != ile[i][0][1] || ile[i][1][0] != ile[i][1][1]) { cout << "NIE"; exit(0); } cout << "TAK"; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include <bits/stdc++.h> using namespace std; int ile[26][2][2]; int n; int main(){ cin >> n; for (int i = 0; i <= 1; i++) for (int j = 0; j < n; j++){ char x; cin >> x; ile[x-'a'][j%2][i]++; } for (int i = 0; i < 26; i++) if (ile[i][0][0] != ile[i][0][1] || ile[i][1][0] != ile[i][1][1]) { cout << "NIE"; exit(0); } cout << "TAK"; return 0; } |