#include <bits/stdc++.h>
using namespace std;
const int INF = int(1e9);
const double EPS = 1e-5;
const long long INF64 = (long long)1e18;
int n, m = 0, ans, nxt;
string s, res;
bool f, g;
int main() {
  cin >> s;
  f = 1;
  g = 1;
  for (int i = 0; i < s.length(); i++) {
    m += (s[i] == '1');
    if (s[i] == '0') f = 0;
    if (i > 0 && s[i] == '1') g = 0;
  }
  if (g) {
    cout << 1;
    return 0;
  }
  if (f) {
    cout << 2;
    return 0;
  }
  ans = m;
  ans = min(ans, (int)s.length() - m + 2);
  m = 0;
  for (int i = 2; i < s.length() - 1; i++) {
    if (s[i - 1] == '1' && s[i + 1] == '1' && s[i] == '0') s[i] = '1', m++;
    if (s[i - 1] == '0' && s[i + 1] == '0' && s[i] == '1') s[i] = '0', m++;
  }
  if (s.length() > 1 && s[s.length() - 1] == '1' && s[s.length() - 2] == '0')
    m++, s[s.length() - 1] = '0';
  for (int i = s.length() - 1; i >= 0; i--) {
    if (i == s.length() - 1) {
      if (s[i] == '1') m += 2;
    } else {
      if (s[i] == '1' && s[i + 1] == '0') m += 2;
    }
  }
  if (s[0] != s[1]) m--;
  ans = min(ans, m);
  printf("%d", ans);
  return 0;
}
