1from collections import Counter234class Solution:5def canConstruct(self, ransomNote: str, magazine: str) -> bool:67ransomNote_count = dict(Counter(ransomNote))8magazine_count = dict(Counter(magazine))910for key, value in ransomNote_count.items():1112if key in magazine_count:13if value <= magazine_count[key]:14continue15else:16return False1718return False1920return True