Goal: Given a message that contains asterisk-ed out words (profanity), uncensor the text according to the author's swearing habits.
Example: To keep this post safe for work, let's say your friend often writes dummy.
John Doe is a *****y. He's a total d***.
It should become:
John Doe is a dummy. He's a total dummy.
Note: we can't assume the # of asterisks will match the number of bleeped-out characters in a swear. Most people don't carefully count letters when they self-censor.
Solution: There are much smarter solutions based on actual natural language processing (NLP), but here's a just-for-fun approach using a Markov Chain: