Program to duplicate Vowels in String | Function to check for the Vowel ; Function to get the resultant String with vowels duplicated ; Another to store the resultant String ; Loop to check for each character ; Driver Code ; Print the original String ; Print the resultant String
def isVowel ( ch ) : NEW_LINE INDENT ch = ch . upper ( ) NEW_LINE if ( ch == ' A ' or ch == ' E ' or ch == ' I ' or ch == ' O ' or ch == ' U ' ) : NEW_LINE INDENT return True NEW_LINE DEDENT else : NEW_LINE INDENT return False NEW_LINE DEDENT DEDENT def duplicateVowels ( S ) : NEW_LINE INDENT t = len ( S ) NEW_LINE res = " " NEW_LINE for i in range ( t ) : NEW_LINE INDENT if ( isVowel ( S [ i ] ) ) : NEW_LINE INDENT res += S [ i ] NEW_LINE DEDENT res += S [ i ] NEW_LINE DEDENT return res NEW_LINE DEDENT S = " helloworld " NEW_LINE print ( " Original ▁ String : ▁ " , S ) NEW_LINE res = duplicateVowels ( S ) NEW_LINE print ( " String ▁ with ▁ Vowels ▁ duplicated : ▁ " , res ) NEW_LINE