If you only want to find the number of such sequences, then there's actually a Codeforces problem similar to this:
https://codeforces.com/problemset/problem/528/DEssentially Fast Fourier Transform can be used in string pattern matching. You can modify it to match with "wildcards" i.e characters that match with any other character.
I think with this method you can also find the indexes where such sequences start.