#include <bits/stdc++.h>
using namespace std;
void run();
int main() {
  ios::sync_with_stdio(0);
  run();
}
string s;
unsigned dp[1000002][2];
void run() {
  cin >> s;
  int const n = s.size();
  memset(dp, -0, sizeof dp);
  dp[n][0] = 0, dp[n][1] = 1;
  for (int i = n; i--;) {
    dp[i][0] =
        min(dp[i + 1][0] + (s[i] == '1'), dp[i + 1][1] + (s[i] == '0') + 1);
    dp[i][1] =
        min(dp[i + 1][1] + (s[i] == '0'), dp[i + 1][0] + (s[i] == '1') + 1);
  }
  cout << min(dp[0][0], dp[0][1] + 1) << endl;
}
