You are given two strings: a reference string a and a source string b. Part 1: return the index pairs (intervals) of a that represent b. The only worked example reported is a = 'abcdbcd', b = 'sabcd' returning [[1,3],[4,4],[2,4]]. Neither report states the rule behind those pairs (how segments…