Number of Strings That Appear as Substrings in Word
Given an array of strings patterns and a string word, return the number of strings in patterns that exist as a substring in word.
A substring is a contiguous sequence of characters within a string.
Example 1
Input
patterns = ["a","abc","bc","d"], word = "abc"Output
3The strings "a", "abc", and "bc" appear as substrings in "abc", while "d" does not.
Example 2
Input
patterns = ["a","b","c"], word = "aaaaabbbbb"Output
2The strings "a" and "b" appear as substrings in "aaaaabbbbb", while "c" does not.
Constraints
- 1 <= patterns.length <= 100
- 1 <= patterns[i].length <= 100
- 1 <= word.length <= 100
- patterns[i] and word consist of lowercase English letters.