#include <bits/stdc++.h>
using namespace std;
int fw[1000006];
int rev[1000006];
int main() {
  int n;
  string s;
  cin >> s;
  n = s.size();
  if (s[n - 1] == '0') {
    fw[n - 1] = 0;
    rev[n - 1] = 2;
  } else {
    fw[n - 1] = 1;
    rev[n - 1] = 1;
  }
  for (int i = n - 2; i >= 0; i--) {
    if (s[i] == '0') {
      fw[i] = min(fw[i + 1], rev[i + 1] + 1);
      rev[i] = min(rev[i + 1] + 1, fw[i + 1] + 2);
    } else {
      fw[i] = fw[i + 1] + 1;
      rev[i] = min(rev[i + 1], fw[i + 1] + 1);
    }
  }
  cout << min(rev[0] + 1, fw[0]) << endl;
  return 0;
}
