text: String containing first letter of every word in a given string with spaces | C # implementation of above approach ; we are splitting the input based on spaces ( s ) + : this regular expression will handle scenarios where we have words separated by multiple spaces ; charAt ( 0 ) will pick only the first character from the string and append to buffer ; Driver code
code: using System ; using System . Text ; class GFG { private static StringBuilder charBuffer = new StringBuilder ( ) ; public static String processWords ( String input ) { String [ ] s = input . Split ( ' ▁ ' ) ; foreach ( String values in s ) { charBuffer . Append ( values [ 0 ] ) ; } return charBuffer . ToString ( ) ; } public static void Main ( ) { String input = " geeks ▁ for ▁ geeks " ; Console . WriteLine ( processWords ( input ) ) ; } }