<p>Given two strings <code>ransomNote</code> and <code>magazine</code>, return <code>true</code><em> if </em><code>ransomNote</code><em> can be constructed by using the letters from </em><code>magazine</code><em> and </em><code>false</code><em> otherwise</em>.</p>

<p>Each letter in <code>magazine</code> can only be used once in <code>ransomNote</code>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre><strong>Input:</strong> ransomNote = "a", magazine = "b"
<strong>Output:</strong> false
</pre><p><strong class="example">Example 2:</strong></p>
<pre><strong>Input:</strong> ransomNote = "aa", magazine = "ab"
<strong>Output:</strong> false
</pre><p><strong class="example">Example 3:</strong></p>
<pre><strong>Input:</strong> ransomNote = "aa", magazine = "aab"
<strong>Output:</strong> true
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= ransomNote.length, magazine.length &lt;= 10<sup>5</sup></code></li>
	<li><code>ransomNote</code> and <code>magazine</code> consist of lowercase English letters.</li>
</ul>

class Solution {
public:
    bool canConstruct(string ransomNote, string magazine) {
        multimap<char, int> lettersMap;
        for (int i = 0; i < ransomNote.length(); i++){
            lettersMap.insert({ransomNote[i], 0});
        }

        int lettersFound = 0;
        for (int i = 0; i < magazine.length(); i++){
            if (lettersMap.find(magazine[i]) != lettersMap.end()){
                lettersFound++;
                if (lettersFound == ransomNote.length())
                    return true;
                lettersMap.erase(lettersMap.find(magazine[i]));
            }
        }
        return false;

        /*
        int lettersFound = 0;
        for (int i = ransomNote.length() - 1; i > -1; i--){
            for (int j = magazine.length() - 1; j > -1; j--){
                if (magazine[j] == ransomNote[i]){
                    lettersFound++;
                    magazine.erase(j, 1);
                    if (lettersFound == ransomNote.length())
                        return true;
                    break;
                }
            }
        }
        return false;*/
    }
};
11100