#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int l = s.length();
  int cnt = 0, last = 0;
  for (int i = 0; i <= l - 1; i++) {
    if (s[i] == '1') {
      cnt++;
      last = i;
    }
  }
  if (cnt > 1) cnt -= 2;
  int sol = l + last - cnt;
  cout << sol;
  return 0;
}
