Number of Strings That Appear as Substrings in Word

Solution Code

Time Complexity

O(n Σ m_i)

Space Complexity

O(max(m_i)