#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int count = 0;
  while (str != "1") {
    if (str[str.size() - 1] == '0') {
      str.resize(str.size() - 1);
      count++;
    } else {
      for (int i = str.size() - 1; i >= 0; --i) {
        if (str[i] == '1') {
          str[i]--;
          if (i == 0) {
            str.insert(0, "1");
          }
          continue;
        }
        if (str[i] == '0') {
          str[i]++;
          break;
        }
      }
      count++;
    }
  }
  cout << count;
  return 0;
}
