Count Substrings That Include a,b and c. The string s uses only a,b,c. Return the number of contiguous substring occurrences containing at least one of each of these three letters.
### Problem
The string s uses only a,b,c. Return the number of contiguous substring occurrences containing at least one of each of these three letters. Equal substring text at different positions counts separately.
```cpp
class Solution {
public:
int numberOfSubstrings(string s);
};
```
### Examples
**Example 1:**
```text
Input: s = "abca"
Output: 3
Explanation: The qualifying intervals contain abc,abca,and bca.
```
**Example 2:**
```text
Input: s = "aaaa"
Output: 0
Explanation: No substring contains b or c.
```
### Constraints
- s has length 3 to 50000.
- Its characters are only a,b or c.
### Contract considerations
All three letters are required; having at least three characters is insufficient by itself.
```hint Read the boundary condition
Count substring occurrences by position. Include strings missing a required letter and strings with repeated copies of all three letters.
```
### Boundary reminders
All three letters are required; having at least three characters is insufficient by itself.
Overview: Count Substrings That Include a,b and c. The string s uses only a,b,c. Return the number of contiguous substring occurrences containing at least one of each of these three letters.
The string s uses only a,b,c. Return the number of contiguous substring occurrences containing at least one of each of these three letters. Equal substring text at different positions counts separately.
class Solution {
public:
int numberOfSubstrings(string s);
};
Examples
Example 1:
Input: s = "abca"
Output: 3
Explanation: The qualifying intervals contain abc,abca,and bca.
Example 2:
Input: s = "aaaa"
Output: 0
Explanation: No substring contains b or c.
Constraints
s has length 3 to 50000.
Its characters are only a,b or c.
Contract considerations
All three letters are required; having at least three characters is insufficient by itself.
Boundary reminders
All three letters are required; having at least three characters is insufficient by itself.