Find substrings that contain all vowels | Returns true if x is vowel . ; Function to check whether a character is vowel or not ; Outer loop picks starting character and inner loop picks ending character . ; If current character is not vowel , then no more result substrings possible starting from str [ i ] . ; If vowel , then we insert it in hash ; If all vowels are present in current substring ; Driver code
function isVowel ( x ) { return ( x == ' ' x == ' ' x == ' ' x == ' ' x == ' ' ) ; } function findSubstring ( str ) { let hash = new Set ( ) ; let n = str . length ; for ( let i = 0 ; i < n ; i ++ ) { for ( let j = i ; j < n ; j ++ ) { if ( isVowel ( str [ j ] ) == false ) break ; hash . add ( str [ j ] ) ; if ( hash . size == 5 ) document . write ( str . substring ( i , j + 1 ) + " " ) ; } hash . clear ( ) ; } } let str = " " ; findSubstring ( str ) ;