#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  reverse(s.begin(), s.end());
  int len = s.size(), ans = 0;
  for (int i = 0; i < len;) {
    int c1 = 0, c0 = 0, j;
    while (s[i] == '1') {
      c1++;
      i++;
    }
    j = i;
    while (s[i] == '0') {
      c0++;
      i++;
    }
    if (c1 == 0)
      continue;
    else if (c1 == 1)
      ans++;
    else if (c0 == 1) {
      i--;
      ans++;
      s[j] = '1';
    } else if (c0 >= 2 || c0 == 0) {
      ans += 2;
    }
  }
  cout << ans;
  return 0;
}
