@@ -0,0 +1,1046 @@
+class Solution:%0A    # @param S, a string%0A    # @param L, a list of string%0A    # @return a list of integer%0A%0A    def findSubstring(self, S, L):%0A        if not S or not L:%0A            return %5B%5D%0A        word_size = len(L%5B0%5D)%0A        if word_size == 0:%0A            return %5B%5D%0A        word_num = len(L)%0A        total = word_size * word_num%0A        n = len(S)%0A        if total %3E n:%0A            return %5B%5D%0A        needed = collections.defaultdict(int)%0A        for s in L:%0A            needed%5Bs%5D += 1%0A        res = %5B%5D%0A        for i in xrange(n):%0A            found = collections.defaultdict(int)%0A            found_num = 0%0A            for j in xrange(i, i+total, word_size):%0A                word = S%5Bj:j+word_size%5D%0A                if word not in needed:%0A                    break%0A                else:%0A                    found%5Bword%5D += 1%0A                    found_num += 1%0A                    if found%5Bword%5D %3E needed%5Bword%5D:%0A                        break%0A                    elif found_num == word_num:%0A                        res.append(i)%0A        return res%0A

add solution for Substring with Concatenation of All Words