Sliding window | 8 line code | easy understanding
\nclass Solution {\npublic:\n    int numberOfSubstrings(string s) {\n        vector<int> map(3,0);\n        int counter = 0 , ans = 0 , i = 0 , j = 0 ;\n       
```\nclass Solution {\npublic:\n    int numberOfSubstrings(string s) {\n        vector<int> map(3,0);\n        int counter = 0 , ans = 0 , i = 0 , j = 0 ;\n       while(j<s.size())\n        {\n          if(map[s[j++] - \'a\']++ == 0) counter++;   \n           while(counter == 3)\n           {\n               ans += s.size() - j +1;\n               if(map[s[i++] -\'a\']-- == 1) counter--;\n           }\n        }\n        return ans;\n    }\n};\n```
['C', 'Sliding Window', 'C++']