#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
long long add(long long a, long long b) {
  long long ret = a + b;
  if (ret >= 1000000007) ret -= 1000000007;
  return ret;
}
long long subtract(long long a, long long b) {
  long long ret = a - b;
  if (ret < 0) ret += 1000000007;
  return ret;
}
long long mult(long long a, long long b) {
  long long ret = a * b;
  if (ret >= 1000000007) ret %= 1000000007;
  return ret;
}
long long bigmod(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = mult(ret, a);
    b >>= 1;
    a = mult(a, a);
  }
  return ret;
}
long long inverse(long long n) { return bigmod(n, 1000000007 - 2); }
bool base[1000010];
vector<int> primes;
void sieve(int mx) {
  mx += 10;
  int x = sqrt(mx);
  for (int i = 3; i <= x; i += 2)
    if (base[i] == 0)
      for (int j = i * i, k = i << 1; j < mx; j += k) base[j] = 1;
  primes.push_back(2);
  for (int i = 3; i < mx; i += 2)
    if (base[i] == 0) primes.push_back(i);
}
bool checkBit(int n, int i) { return (n & (1 << i)); }
int setBit(int n, int i) { return (n | (1 << i)); }
int resetBit(int n, int i) { return (n & (~(1 << i))); }
char a[1000010];
int main() {
  scanf("%s", a);
  int n = strlen(a);
  int last = -1;
  for (int i = n - 1; i >= 0; --i)
    if (a[i] == '1') {
      last = i;
      break;
    }
  int pos = 0, ans = 1, flag = 0;
  while (pos < last) {
    int j = pos, cnt = 0;
    while (j < last && a[j] == a[pos]) ++j, ++cnt;
    if (flag == 0 && a[pos] == '0') {
      pos = j;
      continue;
    }
    if (flag == 1 && a[pos] == '1') {
      pos = j;
      continue;
    }
    if (cnt == 1)
      ++ans;
    else {
      if (a[pos] == '1' && flag == 0)
        ++ans;
      else if (a[pos] == '0' && flag == 1)
        ++ans;
      flag ^= 1;
    }
    pos = j;
  }
  cout << ans << endl;
  return 0;
}
