#include <bits/stdc++.h>
int main() {
  std::string s;
  std::cin >> s;
  int prevcnt = -1;
  int cnt = 0;
  while (s.size() > 1) {
    std::vector<bool> aval(s.size());
    for (int i = 0; i < s.size(); i++) {
      aval.at(i) = true;
    }
    for (int i = 0; i < s.size() - 1; i++) {
      if (aval.at(i) && aval.at(i + 1)) {
        if (s.at(i) == '0') {
          if (s.at(i + 1) == '1') {
            aval.at(i) = false;
            aval.at(i + 1) = false;
            i++;
          }
        } else if (s.at(i) == '1') {
          if (s.at(i + 1) == '0') {
            aval.at(i) = false;
            aval.at(i + 1) = false;
            i++;
          }
        }
      }
    }
    std::string ts;
    for (int i = 0; i < s.size(); i++) {
      if (aval.at(i)) {
        ts.push_back(s.at(i));
      }
    }
    cnt += s.size() - ts.size();
    s = ts;
    if (cnt == prevcnt) break;
    prevcnt = cnt;
  }
  std::cout << cnt;
  return 0;
}
