36. Super Jump

Time Limit: 1 seconds

Memory Limit: 128 MB

Rating: 900

Problem Statement

Given an array of numbers, $N$, with $0$ being a path and $1$ being an obstacle, find out how many times Mario will need to jump to reach the end of the array. Mario can jump over any amount of obstacles in one go, but he can’t jump over a path. E.g given the array $[0,1,1,0,0,1,0,1,0,0,1,0]$ mario will need to make 4 jumps to get to the end

Input

The first line contains string $N$, made up of characters $0$ and $1$.

Output

Output the answer described in the Problem Statement.

Sample Cases
Sample Input 1:
0011110110

Sample Output 1:
2


Sample Input 2:
100000101011100

Sample Output 2:
4
Explanation

Not available for this problem.

Sources

KL Coding Cup March 2023 > Super Mario > Problem 3

Submit | Back