Removing elements between the two zeros | C # program to delete elements between zeros ; Function to find the string after operation ; Travesing through string ; Checking for character Between two zeros ; deleting the character At specific position ; updating the length of the string ; Driver code
using System ; class GFG { static string findstring ( string s ) { int n = s . Length ; string st = " " ; for ( int i = 1 ; i < n - 1 ; i ++ ) { if ( ( s [ i - 1 ] == '0' && s [ i + 1 ] == '0' ) ) { st = s . Remove ( i , 1 ) ; s = st ; i -- ; if ( i > 0 && s [ i - 1 ] == '0' ) i -- ; n = s . Length ; } } return s ; } static void Main ( ) { Console . Write ( findstring ( "100100" ) ) ; } }