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