#include <bits/stdc++.h>
using namespace std;
char s[1000010];
int dp[1000010][2];
int main() {
  scanf("%s", s);
  int n = strlen(s);
  dp[n][0] = 0;
  dp[n][1] = 2;
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == '1') {
      dp[i][0] = min(dp[i + 1][0] + 1, dp[i + 1][1]);
      dp[i][1] = min(dp[i + 1][0] + 2, dp[i + 1][1]);
    } else {
      dp[i][0] = min(dp[i + 1][0], dp[i + 1][1]);
      dp[i][1] = min(dp[i + 1][0] + 2, dp[i + 1][1] + 1);
    }
  }
  printf("%d\n", min(dp[0][0], dp[0][1] + 2));
  return 0;
}
