#include "bits/stdc++.h" using namespace std; #define FOR(i, a, b) for (int i = (a); i <= (b); ++i) #define REP(i, n) FOR(i, 0, (n) - 1) // Ignacy Boehlke int c[2][52]; int main() { int n; scanf("%d", &n); char in; REP(j, 2) { REP(i, n) { scanf(" %c", &in); ++c[j][(in - 'a') * 2 + (i & 1)]; } } bool ok = true; REP(i, 52) if (c[0][i] != c[1][i]) ok = false; printf(ok ? "TAK\n" : "NIE\n"); }
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" using namespace std; #define FOR(i, a, b) for (int i = (a); i <= (b); ++i) #define REP(i, n) FOR(i, 0, (n) - 1) // Ignacy Boehlke int c[2][52]; int main() { int n; scanf("%d", &n); char in; REP(j, 2) { REP(i, n) { scanf(" %c", &in); ++c[j][(in - 'a') * 2 + (i & 1)]; } } bool ok = true; REP(i, 52) if (c[0][i] != c[1][i]) ok = false; printf(ok ? "TAK\n" : "NIE\n"); } |