#include <iostream> using namespace std; char tab1 [300100]; char tab2 [300100]; int zlicz0[32]; int zlicz1[32]; int main() { // your code goes here int n; scanf("%d\n%s\n%s\n",&n,tab1,tab2); for (int i=0;i<n;i+=2) { zlicz0[tab1[i]-'a']++; if (i<n-1) zlicz1[tab1[i+1]-'a']++; zlicz0[tab2[i]-'a']--; if (i<n-1) zlicz1[tab2[i+1]-'a']--; } for (int i=0;i<'z'-'a'+1;i++) { if(zlicz0[i]||zlicz1[i]) {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 <iostream> using namespace std; char tab1 [300100]; char tab2 [300100]; int zlicz0[32]; int zlicz1[32]; int main() { // your code goes here int n; scanf("%d\n%s\n%s\n",&n,tab1,tab2); for (int i=0;i<n;i+=2) { zlicz0[tab1[i]-'a']++; if (i<n-1) zlicz1[tab1[i+1]-'a']++; zlicz0[tab2[i]-'a']--; if (i<n-1) zlicz1[tab2[i+1]-'a']--; } for (int i=0;i<'z'-'a'+1;i++) { if(zlicz0[i]||zlicz1[i]) {printf("NIE\n");return 0;} } printf("TAK\n"); return 0; } |