#include <bits/stdc++.h> using namespace std; //vector <long long> v; //stack <long long> s, s2; //bbbbaaaa //queue <long long> s, s2; long long int z[1000000], x[30], y[10], m, szu, wy[10][1]; char s1[1000000], s2[1000000], c; int war(const void*a, const void *b) { if(*(long long*)a>*(long long*)b)return(1); return(0); } int main() { long long int d, e, f, g, i, j, q, t, k, a, n, b, w, p, aa, bb, cc, dd, nn, kk; t=1; //scanf("%lld", &t); for(q=1; q<=t; q++) { scanf("%lld%s%s", &n, s1, s2); for(i=0; i<n; i+=2) { x[s1[i]-'a']++; x[s2[i]-'a']--; } for(i=0; i<30; i++) { if(x[i]!=0) { printf("NIE\n"); return(0); } } for(i=1; i<n; i+=2) { x[s1[i]-'a']++; x[s2[i]-'a']--; } for(i=0; i<30; i++) { if(x[i]!=0) { 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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | #include <bits/stdc++.h> using namespace std; //vector <long long> v; //stack <long long> s, s2; //bbbbaaaa //queue <long long> s, s2; long long int z[1000000], x[30], y[10], m, szu, wy[10][1]; char s1[1000000], s2[1000000], c; int war(const void*a, const void *b) { if(*(long long*)a>*(long long*)b)return(1); return(0); } int main() { long long int d, e, f, g, i, j, q, t, k, a, n, b, w, p, aa, bb, cc, dd, nn, kk; t=1; //scanf("%lld", &t); for(q=1; q<=t; q++) { scanf("%lld%s%s", &n, s1, s2); for(i=0; i<n; i+=2) { x[s1[i]-'a']++; x[s2[i]-'a']--; } for(i=0; i<30; i++) { if(x[i]!=0) { printf("NIE\n"); return(0); } } for(i=1; i<n; i+=2) { x[s1[i]-'a']++; x[s2[i]-'a']--; } for(i=0; i<30; i++) { if(x[i]!=0) { printf("NIE\n"); return(0); } } printf("TAK\n"); } return(0); } |