Write count_anagram_windows(s, p) that returns how many substrings of s are anagrams of p (same characters with the same multiplicities, in any order). Substrings at different positions count separately even if they are equal. Comparison is case-sensitive.
Examples
Input: s = "bcaxcabca", p = "abc"
Output: 4
Explanation: "bca" at index 0, "cab" at 4, "abc" at 5 and "bca" at 6.
Input: s = "xyyxyx", p = "yx"
Output: 4
Input: s = "aaaa", p = "aa"
Output: 3
Constraints
0 <= len(s) <= 10**5,1 <= len(p) <= 10**4, printable ASCII- Target: O(len(s)) time; checking every window with sorting is too slow
Goals
- Maintain character counts for a window of fixed width
- Update counts incrementally as the window slides
- Compare two count tables efficiently