Put spaces between words starting with capital letters | C # program to put spaces between words starting with capital letters . ; Function to amend the sentence ; Traverse the string ; Convert to lowercase if its an uppercase character ; Print space before it if its an uppercase character ; Print the character ; if lowercase character then just print ; Driver Code
using System ; public class GFG { public static void amendSentence ( string sstr ) { char [ ] str = sstr . ToCharArray ( ) ; for ( int i = 0 ; i < str . Length ; i ++ ) { if ( str [ i ] >= ' A ' && str [ i ] <= ' Z ' ) { str [ i ] = ( char ) ( str [ i ] + 32 ) ; if ( i != 0 ) Console . Write ( " ▁ " ) ; Console . Write ( str [ i ] ) ; } else Console . Write ( str [ i ] ) ; } } public static void Main ( ) { string str = " BruceWayneIsBatman " ; amendSentence ( str ) ; } }