#include <bits/stdc++.h>
using namespace std;
vector<int> getPairsRemovedVec(vector<int> blockVec) {
  int prev = blockVec.at(0);
  vector<int> resultVec(0);
  for (int i = 1; i < blockVec.size(); i++) {
    int now = blockVec.at(i);
    if (prev + now != 1) {
      resultVec.push_back(prev);
      if (i == blockVec.size() - 1) {
        resultVec.push_back(now);
      }
    } else {
      for (int j = i + 1; j < blockVec.size(); j++) {
        resultVec.push_back(blockVec.at(j));
      }
      break;
    }
    prev = now;
  }
  return resultVec;
}
int main() {
  string s;
  cin >> s;
  vector<int> blockVec;
  for (int i = 0; i < s.length(); i++) {
    blockVec.push_back(s[i] - '0');
  }
  vector<int> originalVec = blockVec;
  while (true) {
    vector<int> newVec;
    if (blockVec.size() >= 2) {
      newVec = getPairsRemovedVec(blockVec);
    } else {
      break;
    }
    if (newVec.size() != blockVec.size()) {
      blockVec = newVec;
      if (blockVec.size() == 0) {
        break;
      }
    } else {
      break;
    }
  }
  cout << originalVec.size() - blockVec.size() << endl;
}
