#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:64000000")
const int MAXN = 1000005;
int n;
string s;
int a[MAXN];
int f[MAXN][2];
inline void init() {
  cin >> s;
  n = (int)s.length();
  for (int i = 0; i < n; ++i) a[i] = (int)(s[i] - '0');
  memset(f, -1, sizeof f);
}
int rec(int x, int y) {
  if (x == n) return y;
  if (f[x][y] != -1) return f[x][y];
  int res = n;
  if (!y) {
    int cur = (2 - a[x]) + rec(x + 1, 1);
    res = min(res, cur);
    cur = a[x] + rec(x + 1, 0);
    res = min(res, cur);
  } else {
    int cur = (1 + a[x]) + rec(x + 1, 0);
    res = min(res, cur);
    cur = (1 - a[x]) + rec(x + 1, 1);
    res = min(res, cur);
  }
  return f[x][y] = res;
}
int main() {
  init();
  int res = rec(0, 0);
  cout << res << endl;
  return 0;
}
