#include<iostream> using namespace std; int t1[52], t2[52]; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; for(int i=1; i<=n; i++) { char z; cin >> z; if(i%2 == 0) t1[(int)z - (int)'a']++; else t1[(int)z - (int)'a' + 26]++; } for(int i=1; i<=n; i++) { char z; cin >> z; if(i%2 == 0) t2[(int)z - (int)'a']++; else t2[(int)z - (int)'a' + 26]++; } for(int i=0; i<52; i++) if(t1[i] == t2[i])continue; else { cout << "NIE" << endl; return 0; } cout << "TAK" << endl; 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 | #include<iostream> using namespace std; int t1[52], t2[52]; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; for(int i=1; i<=n; i++) { char z; cin >> z; if(i%2 == 0) t1[(int)z - (int)'a']++; else t1[(int)z - (int)'a' + 26]++; } for(int i=1; i<=n; i++) { char z; cin >> z; if(i%2 == 0) t2[(int)z - (int)'a']++; else t2[(int)z - (int)'a' + 26]++; } for(int i=0; i<52; i++) if(t1[i] == t2[i])continue; else { cout << "NIE" << endl; return 0; } cout << "TAK" << endl; return 0; } |