#include <stdio.h>
int main() {
int n;
scanf("%d", &n);
char a[n], b[n];
scanf("%s", a);
scanf("%s", b);
bool used[n] = { 0 };
bool found = 0;
for (int i = 0; i < n; i++) {
found = 0;
for (int j = 0; j < n; j++) {
if (a[j] == b[i] && used[j] == 0) {
used[j] = 1;
found = 1;
}
}
if (!found) {
printf("NIE\n");
return 0;
}
}
printf("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 25 26 27 | #include <stdio.h> int main() { int n; scanf("%d", &n); char a[n], b[n]; scanf("%s", a); scanf("%s", b); bool used[n] = { 0 }; bool found = 0; for (int i = 0; i < n; i++) { found = 0; for (int j = 0; j < n; j++) { if (a[j] == b[i] && used[j] == 0) { used[j] = 1; found = 1; } } if (!found) { printf("NIE\n"); return 0; } } printf("TAK\n"); return 0; } |
English