You are given two strings, word1 and word2.
A substring of word1 is considered valid if its characters can be rearranged such that word2 forms a prefix of the rearranged string.
Return the total count 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 forms a prefix of the rearranged string.
Return the total count of valid substrings of word1.
Constraints:
word1.length
word2.length
word1 and word2 consist only of lowercase English letters.