Your question is Duplicate Words From a String. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
An eClinicalWorks clinical note may contain repeated words with different capitalization or punctuation. Write a function that returns every duplicated word exactly once, preserving the order in which each word first appears as a duplicate.
A word is a contiguous sequence of letters or digits, optionally containing internal apostrophes. Matching is case-insensitive, and returned words must be lowercase. Ignore punctuation and whitespace. A word is considered duplicated when it appears at least twice in the input.
text, a string containing zero or more words, spaces, and punctuation.def duplicate_words(text):