class Solution(object):
def findSubstring(self, s, words):
"""
:type s: str
:type words: List[str]
:rtype: List[int]
"""
if s=="" or words==[]:return []
wordLen=len(words[0])
Len=len(words)*wordLen
if Len>len(s):return []
Map={}
ans=[]
for i in range(len(words)):
if words[i] not in Map:
Map[words[i]]=(i,1)
else:
Map[words[i]]=(i,Map[words[i]][1]+1)
for l in range(len(s)-Len+1):
cur=[0]*len(words)
flag=0
for j in range(l,l+Len,wordLen):
curstr=s[j:j+wordLen]
if curstr not in Map:
flag=1
break;
v=Map[curstr][0]
cur[v]+=1
if cur[v]>Map[curstr][1]:
flag=1
break;
if flag==0:
ans.append(l)
return ans