#include <bits/stdc++.h>
using namespace std;
int main() {
  string a = "0", b;
  cin >> b;
  if (b == "1") {
    cout << 0 << endl;
    return 0;
  }
  a += b;
  int ans = 0;
  for (int i = a.length() - 1; i >= 2; i--) {
    if (a[i] == '0')
      ans++;
    else {
      ans += 2;
      int w = i;
      while (a[w] == '1') a[w--] = '0';
      a[w] = '1';
    }
  }
  if (a[0] == '1' && a[1] == '0') ans++;
  cout << ans << endl;
}
