text: Program to duplicate Vowels in String | C # program for printing string with duplicate vowels ; Function to check for the Vowel ; Function to get the resultant string with vowels duplicated ; Another string to store the resultant string ; Loop to check for each character ; Driver Code ; Print the original string ; Print the resultant string
code: using System ; class GFG { static bool isVowel ( char ch ) { ch = char . ToUpper ( ch ) ; return ( ch == ' A ' ch == ' E ' ch == ' I ' ch == ' O ' ch == ' U ' ) ; } static String duplicateVowels ( String str ) { int t = str . Length ; String res = " " ; for ( int i = 0 ; i < t ; i ++ ) { if ( isVowel ( str [ i ] ) ) res += str [ i ] ; res += str [ i ] ; } return res ; } public static void Main ( String [ ] args ) { String str = " helloworld " ; Console . WriteLine ( " Original ▁ String : ▁ " + str ) ; String res = duplicateVowels ( str ) ; Console . WriteLine ( " String ▁ with ▁ Vowels ▁ duplicated : ▁ " + res ) ; } }