<p>Given two strings <code>s</code> and <code>t</code>, return <code>true</code> if <code>t</code> is an <span data-keyword="anagram">anagram</span> of <code>s</code>, and <code>false</code> otherwise.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">s = &quot;anagram&quot;, t = &quot;nagaram&quot;</span></p>

<p><strong>Output:</strong> <span class="example-io">true</span></p>
</div>

<p><strong class="example">Example 2:</strong></p>

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">s = &quot;rat&quot;, t = &quot;car&quot;</span></p>

<p><strong>Output:</strong> <span class="example-io">false</span></p>
</div>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= s.length, t.length &lt;= 5 * 10<sup>4</sup></code></li>
	<li><code>s</code> and <code>t</code> consist of lowercase English letters.</li>
</ul>

<p>&nbsp;</p>
<p><strong>Follow up:</strong> What if the inputs contain Unicode characters? How would you adapt your solution to such a case?</p>

class Solution {
public:
    bool isAnagram(string s, string t) {
        if (s.length() == t.length()) {
            std::unordered_map<char, int> map;
            for (unsigned int i = 0; i < s.length(); i++) {
                auto it = map.find(s[i]);
                if (it != map.end()) {
                    it->second++;
                } else {
                    map.insert({s[i], 1});
                }
            }

            for (unsigned int i = 0; i < s.length(); i++) {
                auto it = map.find(t[i]);
                if (it != map.end()) {
                    it->second--;
                    if (it->second == 0) {
                        map.erase(t[i]);
                    }
                } else {
                    return false;
                }
            } 
            if (map.size() == 0) {
                return true;
            }     
        }
        return false;
    } 
    
};
8900