#include <bits/stdc++.h>
using namespace std;
struct Pnt {
  int x, y;
  Pnt() {}
  Pnt(int _x, int _y) {
    x = _x;
    y = _y;
  }
  bool operator<(const Pnt& o) const {
    if (x != o.x) return x < o.x;
    return y < o.y;
  }
  void show() { printf("Pnt %d %d\n", x, y); }
};
const int MAXN = 1000005;
const int MAXS = 20;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
int n, m;
char s[MAXN];
int f[MAXN][2];
void preGao() {}
void init() {
  if (scanf("%s", s) == EOF) exit(0);
  n = strlen(s);
}
void work() {
  f[n][0] = 0;
  f[n][1] = 2;
  for (int i = n - 1; i >= 0; i--) {
    f[i][0] = f[i + 1][0] + (s[i] == '1');
    f[i][0] = min(f[i][0], f[i + 1][1]);
    f[i][1] = f[i + 1][0] + 2 + (s[i] == '0');
    f[i][1] = min(f[i][1], f[i + 1][1] + (s[i] == '0'));
  }
  printf("%d\n", min(f[0][0], f[0][1]));
}
int main() {
  preGao();
  while (true) {
    init();
    work();
  }
  return 0;
}
