Given a string (ranging from a short sentence to an entire book paragraph), extract all words, count their frequencies, and return the top K most frequent words along with their counts. Requirements: (1) case-insensitive — normalize all words to lowercase; (2) punctuation and whitespace are delimiters, not part of words;…