Menorah
There are \(N\) candles on a Hanukkah menorah. Some of its candles are lit, while others are not. We can represent this menorah as a binary string \(s\), where the \(i\)-th candle is lit if and only if \(s_i = 1\).
You can perform a move on the menorah, which is to light the \(i\)-th candle. However, when you light the \(i\)-th candle, the \(i+1\)-th candle will become unlit (if it exists and was not already unlit).
Output the minimum number of moves needed to light all the candles.
Constraints
\(1 \le N \le 10^5\)
\(S_i \in \left\{ 0, 1 \right\}\)
Input Specification
The first and only line contains the binary string of length \(N\), that represents candle of the menorah.
Output Specification
Output the minimum number of moves needed to light all the candles.
Sample Input 1
1100010111
Sample Output 1
8
Sample Input 2
11101101001010101
Sample Output 2
14
Comments