#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  vector<int> v;
  int q = 0;
  cin >> s;
  for (int i = 0; i < s.length(); i++)
    if (s[i] - 48 == 1) v.push_back(i);
  for (int i = v.size() - 1; i > 0; i--) {
    if (v[i] - v[i - 1] + 1 > 0) q += 2 * (v[i] - (v[i - 1] + 1));
  }
  if (v.size() > 1) q += v.size() + 1;
  if (s.length() > v[v.size() - 1]) {
    q += (s.length() - 1) - v[v.size() - 1];
  }
  cout << q << endl;
  return 0;
}
