#include <bits/stdc++.h>
int min(int a, int b) { return a < b ? a : b; }
int main(void) {
  char s[1000001];
  int i, len, m[2], p[2], j;
  scanf("%s", s);
  len = strlen(s);
  p[0] = 0;
  p[1] = 2;
  for (j = 1; j <= len; j++) {
    m[0] = min(p[0] + (s[j - 1] == '1'), p[1] + (s[j - 1] == '1'));
    m[1] = min(p[1] + (s[j - 1] == '0'), p[0] + 2);
    p[0] = m[0];
    p[1] = m[1];
  }
  printf("%d\n", min(m[0], m[1]));
  return 0;
}
