#include <bits/stdc++.h>
using namespace std;
int one[1000001];
int zero[1000001];
char s[10000002] = "0";
int get(int id) { return s[id] == '1' ? one[id] : zero[id]; }
void solve() {
  scanf("%s", s + 1);
  int slen = strlen(s);
  int leftZero[1000001];
  int leftOne[1000001];
  leftZero[0] = 0;
  leftOne[0] = -1;
  for (int i = 1; i < slen; ++i)
    if (s[i] == '1')
      leftOne[i] = i, leftZero[i] = leftZero[i - 1];
    else
      leftZero[i] = i, leftOne[i] = i - 1;
  one[0] = 1;
  zero[0] = 0;
  for (int i = 1; i < slen; ++i) {
    one[i] = min(one[leftZero[i - 1]] + 1, get(i - 1) + 1);
    zero[i] = min(zero[leftOne[i - 1]] + 1, get(i - 1));
  }
  printf("%d\n", get(slen - 1));
}
int main() {
  solve();
  return 0;
}
