Problem
Given a string s made only of the letters a, b and c, return the number of substrings that contain at least one of each of the three letters.
Example 1
- Input
- s = "abcabc"
- Output
- 10
Example 2
- Input
- s = "aaacb"
- Output
- 3
- Why
- "aaacb", "aacb", "acb"
Example 3
- Input
- s = "abc"
- Output
- 1
Constraints
3 <= s.length <= 5 * 10^4s only consists of a, b or c characters.