easy solution
Intuitionuse sliding window with a dictionaryApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
use sliding window with a dictionary

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def validSubstringCount(self, word1: str, word2: str) -> int:
        l = 0
        d = Counter()
        key = Counter(word2)
        res = 0
        for r in range(len(word1)):
            d[word1[r]] += 1
            while d >= key and l <= r:
                res += (len(word1) - r)
                d[word1[l]] -= 1
                if d[word1[l]] == 0:
                    del d[word1[l]]
                l += 1
        return res



        
```
['Python3']