Finding the largest not-necessarily contiguous alternating binary string after inverting any sub-string from a given string
The score is equal to the number of edges, that is transitions from 0 to 1 and from 1 to 0. After flipping number of edges inside the flipped range remains unchanged. Flipping may add two extra edges on the range boundaries; for that you need to find two occurrences of 11 or 00 and make the range to flip just one digit in each.

For example,

    100101001
      ^^^^^
    101010101


Of course there are some corner cases to be considered.