✅Explained w/ Images🏆Made Easy🔥C++
\uD83D\uDE09Don\'t just watch & move away, also give an Upvote.\uD83D\uDE09\n\n###### I\'ve used acronym wind. for window.\n###### And acronym substr. for subst
# \uD83D\uDE09Don\'t just watch & move away, also give an Upvote.\uD83D\uDE09\n\n###### I\'ve used acronym ***wind.*** for ***window***.\n###### And acronym ***substr.*** for ***substring***.\n\n![leetcode 1358_1.jpg](https://assets.leetcode.com/users/images/343f8496-0610-4bda-9e65-c97a6fb7b458_1682576897.4123032.jpeg)\n\n![leetcode 1358_2.jpg](https://assets.leetcode.com/users/images/865e5f8f-6a1f-4186-a73a-d36f1b976bd5_1682576922.321084.jpeg)\n\n\n# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(27)$$ `for hash`\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n# \uD83D\uDE09Please upvote it motivates me\uD83D\uDE09\n# Code\n```\nclass Solution {\npublic:\n    int numberOfSubstrings(string s) {\n        int n = size(s);\n\n        int i=0,j=0,count=0;\n\n        unordered_map<char, int> mp;\n\n        while(j<n)\n        {\n            mp[s[j]]++;\n\n            while(mp[\'a\']>=1 && mp[\'b\']>=1 && mp[\'c\']>=1)\n            {\n                count += (n - j);\n\n                //shrinking the window\n                mp[s[i]]--;\n                i++;\n            }\n            j++;\n        }\n\n\n<!-- \u2705Well before returning "count" don\'t forget to UPVOTE.\u2705 -->\n        return count;\n    }\n};\n```\n### If there\'s any doubt please feel free to comment.\n![Leetcode Upvote.gif](https://assets.leetcode.com/users/images/0f5cb7f7-08ee-47c0-aade-b01fc4bc644a_1682580196.8159347.gif)\n
['C', 'Sliding Window', 'Python', 'C++', 'Java']