You are given two strings, word1 and word2.
A substring of word1 is considered valid if its characters can be rearranged such that word2 becomes a prefix of the rearranged substring.
Return the total number of valid substrings of word1.
Constraints:
word1.length
word2.length
word1 and word2 consist only of lowercase English letters.
You are given two strings, word1 and word2.
A substring of word1 is considered valid if its characters can be rearranged such that word2 becomes a prefix of the rearranged substring.
Return the total number of valid substrings of word1.
Constraints:
word1.length
word2.length
word1 and word2 consist only of lowercase English letters.