Count pair of strings whose concatenation has every vowel | Function to return the count of all concatenated string with each vowel at least once ; Concatenating all possible pairs of string ; Creating an array which checks , the presence of each vowel ; Checking for each vowel by traversing the concatenated string ; Checking if all the elements are set in vowel [ ] ; Check if all vowels are present or not ; Return the final count ; Driver Code ; Given array of strings ; Function call
def good_pair ( st , N ) : NEW_LINE INDENT countStr = 0 NEW_LINE for i in range ( N ) : NEW_LINE INDENT for j in range ( i + 1 , N ) : NEW_LINE INDENT res = st [ i ] + st [ j ] NEW_LINE vowel = [ 0 ] * 5 NEW_LINE for k in range ( len ( res ) ) : NEW_LINE INDENT if ( res [ k ] == ' a ' ) : NEW_LINE INDENT vowel [ 0 ] = 1 NEW_LINE DEDENT elif ( res [ k ] == ' e ' ) : NEW_LINE INDENT vowel [ 1 ] = 1 NEW_LINE DEDENT elif ( res [ k ] == ' i ' ) : NEW_LINE INDENT vowel [ 2 ] = 1 NEW_LINE DEDENT elif ( res [ k ] == ' o ' ) : NEW_LINE INDENT vowel [ 3 ] = 1 NEW_LINE DEDENT elif ( res [ k ] == ' u ' ) : NEW_LINE INDENT vowel [ 4 ] = 1 NEW_LINE DEDENT DEDENT temp = 0 NEW_LINE for ind in range ( 5 ) : NEW_LINE INDENT if ( vowel [ ind ] == 1 ) : NEW_LINE INDENT temp += 1 NEW_LINE DEDENT DEDENT if ( temp == 5 ) : NEW_LINE INDENT countStr += 1 NEW_LINE DEDENT DEDENT DEDENT return countStr NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT arr = [ " aaweiolkju " , " oxdfgujkmi " ] NEW_LINE N = len ( arr ) NEW_LINE print ( good_pair ( arr , N ) ) NEW_LINE DEDENT