Count substrings containing at least one of each: "a", "b", "c".
For each right, track last seen position of a,b,c. Valid substrings end at right, start at 0..min(last[a],last[b],last[c]).
- Track last seen index of a, b, c (init -1)
- For each position: update last seen for current char
- Count = min(last[a], last[b], last[c]) + 1 (all starting points that form valid window)
- Add to total
- Time Complexity: O(n)
- Space Complexity: O(1)