text: If all the characters are present counting number of substrings possible
code: while ( freq [ 0 ] > 0 && freq [ 1 ] > 0 && freq [ 2 ] > 0 ) { freq [ str . charCodeAt ( i ++ ) - ' ' . charCodeAt ( 0 ) ] -- ; }