You are given a string word and an array of strings forbidden.
A substring of word is called valid if none of the strings present in forbidden appear as a substring within it.
Return the length of the longest valid substring of word.
Constraints:
word.length
word consists only of lowercase English letters.
forbidden.length
forbidden[i].length
forbidden[i] consists only of lowercase English letters.
You are given a string word and an array of strings forbidden.
A substring of word is called valid if none of the strings present in forbidden appear as a substring within it.
Return the length of the longest valid substring of word.
Constraints:
word.length
word consists only of lowercase English letters.
forbidden.length
forbidden[i].length
forbidden[i] consists only of lowercase English letters.