Given a binary string s, the following two operations can be performed in any sequence:
Type 1: Remove the character at the start of the string s and append it to the end of the string.
Type 2: Pick any character from the string and flip its value. In other words, if its value is 0, it becomes 1, and vice versa.
Your task is to return the minimum number of type-2 operations you must perform before s becomes alternating.
Note: The string is called alternating if no two adjacent characters are equal.
Constraints: