class Solution {
public:
bool isAnagram(string s, string t) {
if (s.length() != t.length()) return false;
int N = s.length();
map<char, int> freq_t, freq_s;
for(int i=0; i<N; i++){
freq_t[t[i]]++;
freq_s[s[i]]++;
}
return (freq_t == freq_s);
}
};