Binary Game!!

0

0 votes
Problem

Alice loves math very much. That's why when he is bored he plays with a number performing some operations.

Alice takes some positive integer x and wants to get a number one from it. While x is not equal to 1, Alice repeats the following action:

if x is odd, then he adds 1 to it,

otherwise, he divides x by 2. Alice knows that for any positive integer number the process ends in finite time.

How many actions should Alice perform to get a number one from number x?

Input:

The first line contains a positive integer x in a binary system.

Output:

Print the required number of actions.

Constraints:

The number of its digits does not exceed 106.

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?