Akuna CapitalOA #5
Binary Circuit
估计中等可在线判题
Move all 1s in the binary string to the end. One operation picks a 1 and moves it right to the farthest position, just before the next 1 or at the end of the string; the cost of the operation is 1 plus the number of positions moved. Choose the order of operations to maximize the total cost. If the string is already 0...01...1, the cost is 0.
输入格式
The input is one line with the binary string s. The original range 1≤|s|≤100000 is used.
输出格式
Output the maximum total cost needed to complete the grouping.
样例 1
输入:
110100
输出:
13
样例 2
输入:
10100
输出:
8
样例 3
输入:
000111
输出:
0