#include <iostream> #include <string> #include <vector> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; string A,B; cin >> n >> A >> B; vector<vector<int>> Occ(2, vector<int>('z'+1)); for(int i=0;i<n;i++){ Occ[i%2][A[i]]++; Occ[i%2][B[i]]--; } bool failed = false; for(int i=0;i<2;i++) for(int j='a';j<='z';j++) if(Occ[i][j]) failed = true; cout << (failed?"NIE\n":"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 | #include <iostream> #include <string> #include <vector> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; string A,B; cin >> n >> A >> B; vector<vector<int>> Occ(2, vector<int>('z'+1)); for(int i=0;i<n;i++){ Occ[i%2][A[i]]++; Occ[i%2][B[i]]--; } bool failed = false; for(int i=0;i<2;i++) for(int j='a';j<='z';j++) if(Occ[i][j]) failed = true; cout << (failed?"NIE\n":"TAK\n"); return 0; } |