#include <bits/stdc++.h>
char x[1000010];
int main(void) {
  int i, ans, c;
  scanf("%s", x);
  if (strlen(x) == 1) {
    if (x[0] == '1')
      printf("0\n");
    else
      printf("1\n");
    return 0;
  }
  for (c = ans = 0, i = strlen(x) - 1; i >= 0; i--) {
    if (x[i] == '1') {
      if (!(i == 0 && c == 0)) {
        ans++;
        if (c == 0) ans++, c = 1;
      }
    } else {
      if (c == 1)
        x[i] = '1', i++, c = 0;
      else
        ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
