#include <bits/stdc++.h>
using namespace std;
const int mxn = 1000100;
int n, d[mxn][2], pr[mxn];
char s[mxn];
int main() {
  gets(s);
  n = strlen(s);
  int pr = -1;
  for (int i = 0, j; i < n; i = j) {
    if (s[i] == '0')
      j = i + 1;
    else {
      for (j = i; s[j] == '1'; ++j)
        ;
      int k = j - i;
      if (pr == -1) {
        d[j - 1][0] = min(k, 2);
        d[j - 1][1] = 2;
      } else {
        int l = i - pr - 1;
        d[j - 1][0] = min(d[pr][0] + min(k, 2), d[pr][1] + l);
        d[j - 1][1] = min(d[pr][0] + 2, d[pr][1] + l);
      }
      pr = j - 1;
    }
  }
  printf("%d\n", d[pr][0]);
  return 0;
}
