Sliding Window Java
\n\n\nclass Solution {\n    public int numberOfSubstrings(String s) {\n        int count=0,a=0,b=0,c=0;\n        int i=0,j=0;\n       while(j<s.length()){\n    
\n\n```\nclass Solution {\n    public int numberOfSubstrings(String s) {\n        int count=0,a=0,b=0,c=0;\n        int i=0,j=0;\n       while(j<s.length()){\n           if(s.charAt(j)==\'a\')a++;\n           else  if(s.charAt(j)==\'b\')b++;\n           else  if(s.charAt(j)==\'c\')c++;\n             \n           while(a>0&&b>0&&c>0){\n               count+=s.length()-j;\n               if(s.charAt(i)==\'a\')a--;\n               else  if(s.charAt(i)==\'b\')b--;\n               else  if(s.charAt(i)==\'c\')c--;\n               i+=1;\n           } \n           j+=1;\n           \n       }\n        return count;\n    }\n}\n```
['Sliding Window', 'Java']