#include <bits/stdc++.h>
using namespace std;
template <class F, class T>
T convert(F a, int p = -1) {
  stringstream ss;
  if (p >= 0) ss << fixed << setprecision(p);
  ss << a;
  T r;
  ss >> r;
  return r;
}
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T cube(T x) {
  return x * x * x;
}
template <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
  return s == 0 ? 0 : cntbit(s >> 1) + (s & 1);
}
const double PI = acos(-1.0);
const double eps = 1e-9;
const int dr[] = {-1, 0, +1, 0};
const int dc[] = {0, +1, 0, -1};
const int inf = (int)1e9 + 5;
const long long linf = (long long)1e16 + 5;
const long long mod = (long long)1e9 + 7;
char s[2000005];
int main() {
  scanf("%s", s);
  int n = strlen(s);
  int res = 0;
  int d = -1;
  int num0 = 0, num1 = 0;
  bool start = true;
  for (int i = 0; i < (n); ++i) {
    if (d == -1) {
      if (s[i] == '1') {
        if (s[i + 1] == '1') {
          d = 1;
        } else {
          d = 0;
          num1++;
        }
      } else {
        d = 0;
        num0++;
      }
    } else if (d == 0) {
      if (s[i] == '1') {
        if (s[i + 1] == '1') {
          if (start)
            res += num1;
          else
            res += min(num0 - 2, num1);
          num0 = 0;
          num1 = 0;
          d = 1;
          start = false;
        } else {
          num1++;
        }
      } else {
        num0++;
      }
    } else {
      if (s[i] == '0') {
        res += 2;
        num0 = 1;
        num1 = 0;
        d = 0;
        start = false;
      }
    }
  }
  if (d == 0)
    res += num1;
  else
    res += 2;
  cout << res;
  return 0;
}
