# Time Complexity - O(n)
class Solution:
def canConstruct(self, ransomNote: str, magazine: str) -> bool:
m = {}
for s in magazine:
try:
m[s] += 1
except Exception:
m[s] = 1
for s in ransomNote:
try:
m[s] -= 1
if m[s] == 0:
del m[s]
except Exception:
return False
return True