#include <bits/stdc++.h>
char s[1000001];
int dp[1000001][2];
int min(int a, int b) { return a < b ? a : b; }
int main() {
  scanf("%s", s);
  int n = strlen(s);
  int i;
  for (i = 0; i <= n; i++) {
    dp[i][0] = 100000000;
    dp[i][1] = 100000000;
  }
  dp[n][0] = 0;
  for (i = n - 1; i >= 0; i--) {
    int acos = s[i] == '0' ? 0 : 1;
    int bcos = s[i] == '0' ? 1 : 0;
    dp[i][0] = min(dp[i + 1][0], dp[i + 1][1]) + acos;
    dp[i][1] = min(dp[i + 1][0] + 2, dp[i + 1][1]) + bcos;
  }
  printf("%d\n", min(dp[0][0], dp[0][1]));
  return 0;
}
