leftSs and rightSs, to store the indices of s that match the prefix and suffix of t respectively.s and t from the beginning to find the prefix match and store the indices in leftSs.s and t from the end to find the suffix match and store the indices in rightSs.t from both ends.rightSs and for each index, use binary search on leftSs to find the maximum non-overlapping prefix of t.