#include <iostream> #include <map> #include <vector> using namespace std; int main() { char c; int n; std::cin >> n; std::map<char, vector<int>> m1, m2; for(char a = 'a'; a <= 'z'; a++) { m1[a] = {0, 0}; m2[a] = {0, 0}; } for(int i = 0; i < n; i++) { cin >> c; m1[c][i%2]++; } for(int i = 0; i < n; i++) { cin >> c; m2[c][i%2]++; } if(m1 == m2) std::cout << "TAK\n"; else std::cout << "NIE\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 | #include <iostream> #include <map> #include <vector> using namespace std; int main() { char c; int n; std::cin >> n; std::map<char, vector<int>> m1, m2; for(char a = 'a'; a <= 'z'; a++) { m1[a] = {0, 0}; m2[a] = {0, 0}; } for(int i = 0; i < n; i++) { cin >> c; m1[c][i%2]++; } for(int i = 0; i < n; i++) { cin >> c; m2[c][i%2]++; } if(m1 == m2) std::cout << "TAK\n"; else std::cout << "NIE\n"; return 0; } |