fn main() { let mut s = String::new(); std::io::stdin().read_line(&mut s).unwrap(); let mut s = s.trim().bytes().collect::>(); let mut ans = 0; while s.len() > 0 { if *s.last().unwrap() == b'0' { s.pop(); } else { let len = s.len(); if len == 1 || s[len - 2] == b'0' { ans += 1; s.pop(); } else { ans += 1; while s.last().map_or(false, |p| *p == b'1') { s.pop(); } s.pop(); s.push(b'1'); } } } println!("{}", ans); }