#include <cstdio> int odd[256]; int even[256]; int n; char zabawkiIN[300010],zabawkiOUT[300010]; int main(){ scanf(" %d ",&n); scanf(" %s %s",&zabawkiIN, &zabawkiOUT ); for(int i=0; i<n; i++){ switch(i%2){ case 0: even[ zabawkiIN[i] ]++; break; case 1: odd[ zabawkiIN[i] ]++; break; } } for(int i=0; i<n; i++){ switch(i%2){ case 0: if(even[ zabawkiOUT[i] ] == 0){ printf("NIE\n"); return 0; } even[ zabawkiOUT[i] ]--; break; case 1: if(odd[ zabawkiOUT[i] ] == 0){ printf("NIE\n"); return 0; } odd[ zabawkiOUT[i] ]--; break; } } printf("TAK\n",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 32 33 34 35 36 37 38 39 40 41 | #include <cstdio> int odd[256]; int even[256]; int n; char zabawkiIN[300010],zabawkiOUT[300010]; int main(){ scanf(" %d ",&n); scanf(" %s %s",&zabawkiIN, &zabawkiOUT ); for(int i=0; i<n; i++){ switch(i%2){ case 0: even[ zabawkiIN[i] ]++; break; case 1: odd[ zabawkiIN[i] ]++; break; } } for(int i=0; i<n; i++){ switch(i%2){ case 0: if(even[ zabawkiOUT[i] ] == 0){ printf("NIE\n"); return 0; } even[ zabawkiOUT[i] ]--; break; case 1: if(odd[ zabawkiOUT[i] ] == 0){ printf("NIE\n"); return 0; } odd[ zabawkiOUT[i] ]--; break; } } printf("TAK\n",n); return 0; } |