Minimum removal of consecutive similar characters required to empty a Binary String | Function to find minimum steps to make the string empty ; Stores the modified string ; Size of string ; Removing substring of same character from modified string ; Prlet the minimum steps required ; Given string S ; Function Call
function minSteps ( S ) { let new_str = " " ; let N = S . length ; let i = 0 ; while ( i < N ) { new_str += S [ i ] ; let j = i ; while ( i < N && S [ i ] == S [ j ] ) ++ i ; } document . write ( Math . ceil ( ( new_str . length + 1 ) / 2.0 ) ) ; } let S = " " ; minSteps ( S )