Tessian Guardian analyzes email text for combinations of terms that may indicate a risky message. Given an email body and two distinct target words, return the number of pairs formed by one occurrence of each target word anywhere in the text.
Matching is case-insensitive. A word is a contiguous sequence of ASCII letters, and punctuation separates words. Each occurrence is counted independently, so if word1 appears twice and word2 appears three times, the result is six.
Implement count_cooccurrences(text, word1, word2).
text, word1, and word2, all strings. The target words contain only ASCII letters and are distinct.def count_cooccurrences(text, word1, word2):