Replace all consonants with nearest vowels in a string | C # program to replace all consonants with nearest vowels in a string ; Function to replace consonant with nearest vowels ; Driver code
using System ; public class solution { static String replacingConsonants ( String s ) { String str = " aaaeeeeiiiiioooooouuuuuuuu " ; char [ ] st = s . ToCharArray ( ) ; for ( int i = 0 ; i < s . Length ; i ++ ) { int index = st [ i ] - ' a ' ; st [ i ] = str [ index ] ; } String str1 = new String ( st ) ; return str1 ; } public static void Main ( ) { String s = " geeksforgeeks " ; Console . WriteLine ( replacingConsonants ( s ) ) ; } }