You are given a language model output string (text) and a list of source strings (sources). Your task is implemented in up to three progressive parts: Part 1 – Count Matches: Return a list of match counts, one per source, indicating how many times each source phrase appears in the…