Count N | to keep the string in lexicographically sorted order use start index to add the vowels starting the from that index ; base case : if string length is 0 add to the count ; if last character in string is ' e ' add vowels starting from ' e ' i . e ' e ' , ' i ' , ' o ' , 'u ; decrease the length of string ; char arr [ 5 ] = { ' a ' , ' e ' , ' i ' , ' o ' , ' u ' } ; starting from index 0 add the vowels to strings
def countstrings ( n , start ) : NEW_LINE INDENT if n == 0 : NEW_LINE INDENT return 1 NEW_LINE DEDENT cnt = 0 NEW_LINE DEDENT ' NEW_LINE INDENT for i in range ( start , 5 ) : NEW_LINE INDENT cnt += countstrings ( n - 1 , i ) NEW_LINE DEDENT return cnt NEW_LINE DEDENT def countVowelStrings ( n ) : NEW_LINE INDENT return countstrings ( n , 0 ) NEW_LINE DEDENT n = 2 NEW_LINE print ( countVowelStrings ( n ) ) NEW_LINE