#include <bits/stdc++.h>
using namespace std;
string str;
int N, memo[1000090][2];
void ini() { memset(memo, -1, sizeof(memo)); }
int dp(int cur, int yes) {
  if (cur == N) {
    return yes;
  }
  int &ret = memo[cur][yes], use = 0;
  if (ret != -1) return ret;
  ret = 21474836;
  if ((str[cur] == '1' && !yes) || (str[cur] == '0' && yes)) {
    ret = dp(cur + 1, yes ^ 1) + 1;
    ret = min(dp(cur + 1, yes) + 1, ret);
  } else {
    ret = min(ret, dp(cur + 1, yes));
    ret = min(ret, dp(cur + 1, yes ^ 1) + 1);
  }
  return ret;
}
int main() {
  while (cin >> str) {
    N = str.size();
    reverse(str.begin(), str.end());
    ini();
    int ret = dp(0, 0);
    cout << ret << endl;
  }
  return 0;
}
