LearnPy Hub
← Arena
AdvancedRating 1600

Fewest Swaps to Group the Ones

The circle of 0s and 1s (the last is next to the first) should have all its 1s next to each other. In one swap you exchange any two positions. Print the fewest swaps.

Input

A string of 0s and 1s.

Output

One integer.

Sample 1

Input
0100101
Output
1

Sample 2

Input
011110011
Output
1
solution.py
Output appears here
Fewest Swaps to Group the Ones · Python Arena problem · LearnPy Hub