Mask banned word

Write codeMedium15 min

Your task

A moderation filter masks a banned word. Given a message and a non-empty banned word, replace every occurrence of the banned word with asterisks of the same length. Matching is case-sensitive; scan left to right, and after masking an occurrence continue scanning right after it (matches never overlap). For example, censoring 'magic' in 'say the magic word, magic!' gives 'say the ***** word, *****!'.

Examples

censor(message: str, banned: str) -> str
Example 1
Inputcensor("say the magic word, magic!", "magic")
Output"say the ***** word, *****!"