#include <bits/stdc++.h>
using namespace std;
char s[1000002];
int o = 0, len;
int main() {
  cin >> s;
  if ((s[0] == '1') && (strlen(s) == 1)) {
    cout << 0;
    return 0;
  }
  for (int i = strlen(s); i >= 0; i--) {
    s[i + 1] = s[i];
  }
  s[0] = '0';
  int i = strlen(s) - 1;
  while (i > 0) {
    if (s[i] == '0') {
      o += 1;
      i--;
    } else {
      if (i == 1) break;
      o++;
      while (s[i] == '1') {
        o++;
        i--;
      }
      s[i] = '1';
    }
  }
  cout << o;
}
