Spell word with magnets
Your task
A box of fridge-magnet letters is given as the string tiles, one character per magnet. Return True if you can spell word using those magnets, consuming each magnet at most once. Matching is case-sensitive. Example: word 'moon' with tiles 'nofmoto' is True, the box holds an m, two o's, and an n.
Examples
can_build_word(word: str, tiles: str) -> boolExample 1
Input
can_build_word("moon", "nofmoto")Output
True