[C++] Variable Sized Sliding Window
\n// The below soln can be called as a Variable Sized Sliding Window algorithm or\n// an application of the 2 pointer agorithm \n// Time: O(n)\n// Space: O(1)\n
```\n// The below soln can be called as a Variable Sized Sliding Window algorithm or\n// an application of the 2 pointer agorithm \n// Time: O(n)\n// Space: O(1)\n\nclass Solution {\npublic:\n    bool isGoodSubstring(vector<int> v)\n    {\n         return (v[0] >= 1 && v[1] >= 1 && v[2] >= 1);\n    }\n    \n    int numberOfSubstrings(string s) \n    {\n        int total = 0;\n        vector<int> counts(3,0);\n        int n = s.length();\n        int i = 0;\n        int j = 0;\n        \n        while (j < s.length()) {\n            counts[s[j] - \'a\']++;\n            if (!isGoodSubstring(counts)) {\n                j++;\n            }\n            else {\n                while (isGoodSubstring(counts)) {\n                    total += (n - j);\n                    counts[s[i] - \'a\']--;\n                    i++;\n                }\n                j++;\n            }\n        }\n        \n        return total;\n    }\n};\n```
['C', 'Sliding Window']