1# Runtime: 1522 ms (Top 17.46%) | Memory: 14.2 MB (Top 76.15%)2class Solution:3def findSubstring(self, s: str, words: List[str]) -> List[int]:4req = {}5for i in words:6req[i] = 1 + req.get(i, 0)7l = 08r = len(words) * len(words[0])9ans = []1011while r < len(s) + 1:12i = 013curr = {}14left, right = l, l + len(words[0])15while right < l + len(words) * len(words[0]) + 1:16x = s[left:right]17# print(x)18if x in req.keys():19curr[x] = 1 + curr.get(x, 0)20left = right21right = right + len(words[0])22if req == curr:23ans.append(l)24l = l + 125r = r + 126return ans