You are given a binary string of length . You are asked to convert the given string in the format such that no two zeros or no two ones are together in the string.
You are allowed to perform the operation:
Find the minimum number of moves required to convert the string in the required format.
A binary string is a string consisting of only zeros and ones.
Input format
Output format
Print the minimum number of operations required to change a provided string into the required string format.
Constraints
Let the targe string be 10101, so start iterating from begin, index 1st and 2nd of required and given string are same, we got conflict at index 3, so we use operation on index 3rd and 4th as :
"00" -> "10", and 5th index again is same, so only one operation is required.