|| ||Code Submission Evaluation System
CSES - HIIT Open 2018
HIIT Open 2018
|Contest start:||2018-05-26 11:00:00|
|Contest end:||2018-05-26 16:00:00|
Task list | Submit code | Submissions | Messages | Scoreboard | Statistics
You are given a bit string, and your task is to modify it so that no adjacent bits have the same value. On each turn, you may select any bit and invert
it (from 0 to 1 or from 1 to 0). What is the minimum number of inversions if you act optimally?
The only input line has a bit string of length $n$.
Print one integer: the minimum number of inversions.
Explanation: You can invert the third and fourth bit, and the resulting string is 010101.