#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
void dbg() { cerr << "\n"; }
template <typename T, typename... T2>
void dbg(const T& fst, const T2&... rst) {
  cerr << fst << ": ";
  dbg(rst...);
}
long long gcd(long long x, long long y) { return y == 0 ? x : gcd(y, x % y); }
long long lcm(long long x, long long y) { return (x / gcd(x, y) * y); }
int main() {
  string s;
  cin >> s;
  int n = (int)(s).size();
  bool nxt = true;
  while (nxt) {
    nxt = false;
    for (int(i) = 0; (i) < (n - 1); (i)++) {
      if (s[i] == '0' && s[i + 1] == '1') {
        s[i] = s[i + 1] = '9';
        nxt = true;
      }
      if (s[i] == '1' && s[i + 1] == '0') {
        s[i] = s[i + 1] = '9';
        nxt = true;
      }
      s.erase(remove((s).begin(), (s).end(), '9'), s.end());
    }
  }
  cout << n - (int)(s).size() << "\n";
  return 0;
}
