simplest and fastest solution || best for beginner s
jsut read the code and you will understand the apporach simple sliding window approach this is \n\n\n### okay one thing why  count += s.length() - end  ? \n- th
# jsut read the code and you will understand the apporach simple sliding window approach this is \n\n\n### okay one thing why  count += s.length() - end  ? \n- the and is simple let say we have     \n```\nabcccc ; \n--\u2191 // at this point we have a window with all  : a , b , c  \nnow no of possible subStrings that can generate from here is \nabc\nabcc , \nabccc , \nabcccc , \nwhich is simpele the reminaing letteres are allso add in this \n```\n\n# Code\n```\nclass Solution {\n    public int numberOfSubstrings(String s) {\n        int[] map = new int[3];\n        int start = 0; int end = 0;\n        int count = 0;\n        while (end<s.length()) {\n            char ch=s.charAt(end);\n            map[ch-\'a\']++;\n            while (allPresent(map)) {\n                count += s.length() - end ;\n                 // Update count for the current and future substrings\n                map[s.charAt(start) - \'a\']--; \n                // Reduce the count for the character at the start\n                start++; // Move the start of the window forward\n            }   \n            end++;\n        }   \n        return count;\n    }\n    public boolean allPresent(int[] map) {\n        return map[0] != 0 && map[1] != 0 && map[2] != 0;\n    }\n}\n\n```
['Java']