use std::io::*; fn main() { let mut input: String = String::new(); std::io::stdin().read_to_string(&mut input).ok(); let mut itr = input.trim().split_whitespace(); let mut s: Vec = itr.next().unwrap().chars().rev().collect(); s.push('0'); let n = s.len(); s.push('0'); let mut ans = 0; let mut carry = 0; for i in 0..n { if s[i] == '0' { if carry == 1 { s[i] = '1'; carry = 0; } else { continue; } } if carry == 0 { ans += 1; if s[i+1] == '1' { carry = 1; } } } println!("{}", ans); }