#include <stdio.h> #include <string.h> int T1[33][2], T2[33][2]; int n; char bit[333333], baj[333333]; int main() { scanf("%d", &n); scanf("%s", bit); scanf("%s", baj); memset(T1, 0, sizeof(T1)); memset(T2, 0, sizeof(T2)); for (int i=0; i<n; i++) { T1[bit[i]-'a'][i&1] ++; T2[baj[i]-'a'][i&1] ++; } int ok = 1; for (int i=0; i<26; i++) { if (T1[i][0] != T2[i][0] || T1[i][1] != T2[i][1]) ok = 0; } if (ok) { printf("TAK\n"); } else { printf("NIE\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 25 26 27 28 29 30 31 | #include <stdio.h> #include <string.h> int T1[33][2], T2[33][2]; int n; char bit[333333], baj[333333]; int main() { scanf("%d", &n); scanf("%s", bit); scanf("%s", baj); memset(T1, 0, sizeof(T1)); memset(T2, 0, sizeof(T2)); for (int i=0; i<n; i++) { T1[bit[i]-'a'][i&1] ++; T2[baj[i]-'a'][i&1] ++; } int ok = 1; for (int i=0; i<26; i++) { if (T1[i][0] != T2[i][0] || T1[i][1] != T2[i][1]) ok = 0; } if (ok) { printf("TAK\n"); } else { printf("NIE\n"); } return 0; } |