#include <bits/stdc++.h> using namespace std; using vector3d = vector<vector<vector<int>>>; using vector2d = vector<vector<int>>; using vector1d = vector<int>; int main() { int n; bool wrong = false; string s1, s2; cin >> n >> s1 >> s2; s1 = " " + s1; s2 = " " + s2; vector3d cnt(4, vector2d(4, vector1d(28, 0))); for (int i = 1; i <= n; i++) { cnt[1][i%2][(int)s1[i] - 96]++; cnt[2][i%2][(int)s2[i] - 96]++; } for(int i=1; i<=26; i++) if(cnt[1][0][i] != cnt[2][0][i] or cnt[1][1][i] != cnt[2][1][i]) wrong = true; if(!wrong) cout << "TAK"; else cout << "NIE"; }
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 | #include <bits/stdc++.h> using namespace std; using vector3d = vector<vector<vector<int>>>; using vector2d = vector<vector<int>>; using vector1d = vector<int>; int main() { int n; bool wrong = false; string s1, s2; cin >> n >> s1 >> s2; s1 = " " + s1; s2 = " " + s2; vector3d cnt(4, vector2d(4, vector1d(28, 0))); for (int i = 1; i <= n; i++) { cnt[1][i%2][(int)s1[i] - 96]++; cnt[2][i%2][(int)s2[i] - 96]++; } for(int i=1; i<=26; i++) if(cnt[1][0][i] != cnt[2][0][i] or cnt[1][1][i] != cnt[2][1][i]) wrong = true; if(!wrong) cout << "TAK"; else cout << "NIE"; } |