Given a string band an array of smaller strings T, design a method to search b for each small string in T. Output positions
of all strings in smalls
that appear in big
, where positions[i]
is all positions of smalls[i]
.
Example:
Input: big = "mississippi" smalls = ["is","ppi","hi","sis","i","ssippi"] Output: [[1,4],[8],[],[3],[1,4,7,10],[5]]
Note:
0 <= len(big) <= 1000
0 <= len(smalls[i]) <= 1000
- The total number of characters in
smalls
will not exceed 100000. - No duplicated strings in
smalls
. - All characters are lowercase letters.