- class Solution {
- public:
- map<char,int>mp1;
- map<char,int>mp2;
- bool isAnagram(string s, string t) {
- if(s.size()!=t.size())return false;
- for(auto k:s){
- mp1[k]++;
- }
- for(auto k:t){
- mp2[k]++;
- }
- for(auto k:s){
- if(mp1[k]!=mp2[k])return false;
- }
- return true;
- }
- };