#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
char a[maxn];
int main() {
  char c;
  int i = 0;
  while ((c = getchar()) != '\n') a[i++] = c;
  int len = strlen(a) - 1;
  int sum = 0;
  if (len == 0 && a[0] == '1') {
    printf("0\n");
    return 0;
  }
  while (len > 0) {
    if (a[len] == '0') {
      sum++;
      len--;
    } else if (a[len] == '1') {
      sum += 2;
      while (len) {
        len--;
        if (a[len] == '0') {
          break;
        } else {
          sum++;
        }
      }
      a[len] = '1';
    }
  }
  printf("%d\n", sum);
  return 0;
}
