Best ever easy solution using Sliding Window Easy Understand
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def numberOfSubstrings(self, s: str) -> int:\n        count = 0\n        start = 0\n        end = 0\n        freq = {\'a\': 0, \'b\': 0, \'c\': 0}\n        valid_substrings = 0\n\n        while end < len(s):\n            freq[s[end]] += 1\n\n            while all(freq.values()):\n                freq[s[start]] -= 1\n                start += 1\n\n            valid_substrings += start\n\n            end += 1\n\n        return valid_substrings\n\n```
['Sliding Window', 'Python3']