#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void checkMin(T& a, T b) {
  if (a > b) a = b;
}
template <typename T>
inline void checkMax(T& a, T b) {
  if (a < b) a = b;
}
const int MAXN = 1000100;
const int INF = ~0U >> 2;
int n, m, dp[2][MAXN];
char s[MAXN];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  reverse(s + 1, s + n + 1);
  fill(dp[0], dp[2], INF);
  dp[0][0] = 2, dp[1][0] = 0;
  for (int i = 1; i <= n; ++i) {
    checkMin(dp[0][i], dp[0][i - 1] + (s[i] == '0'));
    checkMin(dp[0][i], dp[1][i - 1] + 2);
    checkMin(dp[1][i], dp[0][i - 1] + (s[i] == '1'));
    checkMin(dp[1][i], dp[1][i - 1] + (s[i] == '1'));
  }
  printf("%d\n", min(dp[0][n], dp[1][n]));
  return 0;
}
