CF92B Binary Number

题目描述

小海狮牙牙非常喜欢学数学。因此,他在无聊的时候经常用数字做♂游♂戏。 牙牙拿了一些正整数 _x_ , 他想通过一些操作将 _x_ 变成1。当 _x_ 不等于1的时候,牙牙会重复下列步骤:如果 _x_ 为奇数,他就会将 _x_ 加上1。如果 _x_ 为偶数,他就会将 _x_ 除以2。牙牙想知道他需要多少步才能将 _x_ 变为1。

输入格式

第一行包含一个二进制的整数 _x_ 。可以保证它的的第一位不是0而且 _x_ 的位数不超过10^6。

输出格式

输出将 _x_ 变为1的步数。 翻译提供者:deadpool123

说明/提示

Let's consider the third sample. Number $ 101110 $ is even, which means that we should divide it by $ 2 $ . After the dividing Fangy gets an odd number $ 10111 $ and adds one to it. Number $ 11000 $ can be divided by $ 2 $ three times in a row and get number $ 11 $ . All that's left is to increase the number by one (we get $ 100 $ ), and then divide it by $ 2 $ two times in a row. As a result, we get $ 1 $ .