Fixed window = p.length(). Compare freq maps (or match counter).
Input
cbaebabacd abc
Output
0 6
abab ab
0 1 2