left and right to 0, and count to 0.freq to keep track of the count of 'a', 'b', and 'c' within the window.right pointer to the right, updating the frequency map accordingly.count by the number of possible substrings from left to the end of the string.
b. Contract the window by moving left pointer to the right and updating the frequency map.
c. Repeat steps 4a and 4b until the window no longer contains all three characters.right reaches the end of the string.count as the final result.