#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
const int N = 2e5 + 10;
int main() {
  string str;
  cin >> str;
  int n = str.length();
  reverse(str.begin(), str.end());
  str.push_back('0');
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (str[i] == '2') str[i] = '0', str[i + 1]++;
    if (i == n - 1 && str[i] == '1') break;
    cnt++;
    if (str[i] == '1') cnt++, str[i + 1]++;
  }
  cout << cnt << endl;
  return 0;
}
