#include<iostream> #include<unordered_map> using namespace std; int main(){ int n; cin >> n; string s1; string s2; unordered_map<char, int> map1; unordered_map<char, int> map2; cin >> s1; cin >> s2; for(char c:s1){ map1[c]++; } for(char c:s2){ map2[c]++; } if(map1!=map2){ cout<<"NIE"; return 0; } cout<<"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 | #include<iostream> #include<unordered_map> using namespace std; int main(){ int n; cin >> n; string s1; string s2; unordered_map<char, int> map1; unordered_map<char, int> map2; cin >> s1; cin >> s2; for(char c:s1){ map1[c]++; } for(char c:s2){ map2[c]++; } if(map1!=map2){ cout<<"NIE"; return 0; } cout<<"TAK"; return 0; } |