#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  reverse(s.begin(), s.end());
  s += '0';
  int ans = 0;
  for (int i = 0; i < (int)s.length() - 1; i++) {
    if (i == (int)s.length() - 2 && s[i] == '1') break;
    if (s[i] == '1') {
      ans += 2;
      s[i + 1]++;
    }
    if (s[i] == '0') ans++;
    if (s[i] == '2') {
      ans++;
      s[i + 1]++;
    }
  }
  cout << ans;
  return 0;
}
