Implement a function anagram_index(lookup, query) that returns the index of the first occurrence of an anagram of query as a consecutive substring in lookup. Return -1 if no such substring exists. Equivalently, given a string s and a pattern p, find the starting index (or all starting indices) of every…