Easy python | with and without sliding window
python\nclass Solution:\n    def numberOfSubstrings(self, s: str) -> int:\n        n = len(s)\n        a = b = c = -1\n        res = 0\n        for i in range(n
```python\nclass Solution:\n    def numberOfSubstrings(self, s: str) -> int:\n        n = len(s)\n        a = b = c = -1\n        res = 0\n        for i in range(n):\n            if s[i]==\'a\': a = i+1\n            if s[i]==\'b\': b = i+1\n            if s[i]==\'c\': c = i+1\n            if a == -1 or b == -1  or c == -1: continue;\n            else: res += min(a,b,c)\n        return res\n```\n# Sliding Window \n```python\nclass Solution:\n    def numberOfSubstrings(self, s: str) -> int:        \n        count = {"a":0,"b":0,"c":0}\n        dataToBeIncluded = 3\n        start,end = 0,0\n        res = 0\n        n = len(s)\n        while end < n:\n            if s[end] in count:\n                if count[s[end]] == 0:\n                    dataToBeIncluded -= 1\n                count[s[end]] += 1   \n            while dataToBeIncluded == 0:\n                res += n-end\n                if s[start] in count:\n                    count[s[start]] -= 1\n                    if count[s[start]] == 0:\n                        dataToBeIncluded += 1\n                start += 1\n            end += 1\n        return res\n```
[]