Spell word with magnets

Write codeEasy10 min

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) -> bool
Example 1
Inputcan_build_word("moon", "nofmoto")
OutputTrue