#include <bits/stdc++.h>
char str[1000010];
int main() {
  int len, ans = 0, n1 = 0, n0 = 0, j = 0, i;
  str[0] = '0';
  scanf("%s", str + 1);
  len = strlen(str);
  if (len > 2) {
    for (i = len; i > 0; i--) {
      if (str[i] == '1') {
        j = i;
        while (str[i - 1] == '1') {
          str[i] = '0';
          i--;
        }
        if (i < j) {
          ans++;
          str[i--] = '0';
          str[i++] = '1';
        }
      }
    }
    for (i = 0; i < len; i++) {
      ans += (str[i] - '0');
    }
  } else if (str[1] == '1')
    ans++;
  printf("%d\n", ans);
  return 0;
}
