#include <bits/stdc++.h>
using namespace std;
string str;
const int N = 1000005;
int dp[N][2];
int call(int pos, int tp) {
  if (pos == str.size()) {
    if (tp == 0)
      return 0;
    else
      return 1e9;
  }
  if (dp[pos][tp] != -1) return dp[pos][tp];
  int ret = 1e9;
  int d = str[pos] - '0';
  if (tp == 0) {
    ret = min(ret, d + call(pos + 1, tp));
    if (d < 1) ret = min(ret, d + 1 + call(pos + 1, 1 - tp));
  } else {
    int f = 2 - d - 1;
    ret = min(ret, f + call(pos + 1, tp));
    ret = min(ret, f + 1 + call(pos + 1, 1 - tp));
  }
  return dp[pos][tp] = ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  memset(dp, -1, sizeof(dp));
  cin >> str;
  reverse(str.begin(), str.end());
  str += "0";
  reverse(str.begin(), str.end());
  cout << call(0, 0) << "\n";
}
