Count of substrings consisting only of vowels | Function to check if a character is vowel or not ; Function to check whether String contains only vowel ; Check if the character is not vowel then invalid ; Function to Count all subStrings in a String which contains only vowels ; Generate all subString of s ; If temp contains only vowels ; Increment the count ; Driver code
function isvowel ( ch ) { return ( ch == ' ' ch == ' ' ch == ' ' ch == ' ' ch == ' ' ) ; } function isvalid ( s ) { let n = s . length ; for ( let i = 0 ; i < n ; i ++ ) { if ( ! isvowel ( s [ i ] ) ) return false ; } return true ; } function CountTotal ( s ) { let ans = 0 ; let n = s . length ; for ( let i = 0 ; i < n ; i ++ ) { let temp = " " ; for ( let j = i ; j < n ; j ++ ) { temp += s [ j ] ; if ( isvalid ( temp ) ) ans += 1 ; } } return ans ; } let s = " " ; document . write ( ( CountTotal ( s ) ) ) ;