Sliding window Approach.Upvote For Karma.
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 {\npublic:\n    int numberOfSubstrings(string s) {\n        unordered_map<char,int>mp;\n        int i=0,j=0,ans=0,n=s.size();\n\n        while(j<n)\n        {\n            mp[s[j]]++;\n            \n            while(mp.size()==3)\n            {\n                ans++;\n                 ans+=n-j-1;\n                mp[s[i]]--;\n                if(mp[s[i]]==0)\n                mp.erase(s[i]);\n                i++;\n                \n            }\n           \n            j++;\n\n        }\n        return ans;\n    }\n};\n```
['C++']