原题链接:Leetcode 383. 赎金信
class Solution {
public:
bool canConstruct(string ransomNote, string magazine) {
if(magazine.size()<ransomNote.size()) return false;
map<char,int> mp;
for(auto x:magazine) mp[x]++;
for(auto x:ransomNote) {
mp[x]--;
if(mp[x]<0) return false;
}
return true;
}
};