C++ Minified
\nint numberOfSubstrings(string s, int res = 0) {\n    for (int i = 0, j = 0, cnt[3] = {}; i < s.size(); res += j) {\n        ++cnt[s[i++] - \'a\'];\n        wh
```\nint numberOfSubstrings(string s, int res = 0) {\n    for (int i = 0, j = 0, cnt[3] = {}; i < s.size(); res += j) {\n        ++cnt[s[i++] - \'a\'];\n        while (cnt[0] && cnt[1] && cnt[2]) \n            --cnt[s[j++] - \'a\'];\n    }\n    return res;\n}\n```
[]