#include<cstdio> #include<algorithm> #include<iostream> using namespace std; string s,s2; int T[30][2]; int main(void){ int n; scanf("%d",&n); cin >> s >> s2; for(int i = 0 ; i < n;i++){ T[s[i]-'a'+1][i%2]++; T[s2[i]-'a'+1][i%2]--; } for(int i = 1; i <= 26;i++){ if(T[i][0] != 0 || T[i][1] != 0){ printf("NIE"); return 0; } } printf("TAK"); 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<cstdio> #include<algorithm> #include<iostream> using namespace std; string s,s2; int T[30][2]; int main(void){ int n; scanf("%d",&n); cin >> s >> s2; for(int i = 0 ; i < n;i++){ T[s[i]-'a'+1][i%2]++; T[s2[i]-'a'+1][i%2]--; } for(int i = 1; i <= 26;i++){ if(T[i][0] != 0 || T[i][1] != 0){ printf("NIE"); return 0; } } printf("TAK"); return 0; } |