Update the max window size if required
if ( curr_end - curr_start + 1 > max_window_size ) { max_window_size = curr_end - curr_start + 1 ; max_window_start = curr_start ; } } Console . WriteLine ( " Max ▁ substring ▁ is ▁ : ▁ " + s . Substring ( max_window_start , max_window_size ) + " ▁ with ▁ length ▁ " + max_window_size ) ; }