#include <bits/stdc++.h>
using namespace std;
long long i, j, k, l, n, temp, len, ans;
int ara[2000000];
char str[2000000];
int main() {
  scanf("%s", str);
  len = strlen(str);
  for (i = 0; i < len; i++) {
    ara[i] = str[i] - '0';
  }
  if (len == 1) {
    cout << 0;
    return 0;
  }
  if (len == 2 && ara[1] == 0) {
    cout << 1;
    return 0;
  }
  for (i = len - 1; i >= 0; i--) {
    if (i == 0 && temp == 0 && ara[0] == 1) {
      break;
    }
    if (ara[i] == 0 && temp == 0) {
      ans++;
    } else if (temp == 1 && ara[i] == 0) {
      temp = 0;
      ara[i] = 1;
      i++;
    } else if (ara[i] == 1 && temp == 0) {
      ans += 2;
      temp = 1;
    } else if (ara[i] == 1 && temp == 1)
      ans++;
  }
  cout << ans;
  return 0;
}
