383:
class Solution(object):
def canConstruct(self, ransomNote, magazine):
"""
:type ransomNote: str
:type magazine: str
:rtype: bool
"""
my_dict = {}
for item in magazine:
my_dict[item] = my_dict.get(item, 0) + 1
for item in ransomNote:
if item in my_dict:
my_dict[item] -= 1
if my_dict[item] < 0:
return False
else:
return False
return True