#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n; cin >> n;
string s1, s2;
cin >> s1 >> s2;
const int alpha = 26;
vector<vector<vector<int>>> fq(2, vector<vector<int>>(alpha, vector<int>(2)));
for (int i = 0; i < n; ++i) {
++fq[0][s1[i] - 'a'][i%2], ++fq[1][s2[i] - 'a'][i%2];
}
for (int i = 0; i < alpha; ++i) {
if (fq[0][i] != fq[1][i]) {
cout << "NIE";
return 0;
}
}
cout << "TAK";
}
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 | #include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; string s1, s2; cin >> s1 >> s2; const int alpha = 26; vector<vector<vector<int>>> fq(2, vector<vector<int>>(alpha, vector<int>(2))); for (int i = 0; i < n; ++i) { ++fq[0][s1[i] - 'a'][i%2], ++fq[1][s2[i] - 'a'][i%2]; } for (int i = 0; i < alpha; ++i) { if (fq[0][i] != fq[1][i]) { cout << "NIE"; return 0; } } cout << "TAK"; } |
English