#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  list<bool> X;
  cin >> S;
  for (char c : S) X.push_back(c == '1');
  int count_all = 0;
  while (true) {
    int count_this_time = 0;
    auto index = X.begin();
    while (true) {
      auto index_next = ++index;
      --index;
      if (index_next == X.end()) break;
      auto index_next2 = ++index_next;
      --index_next;
      if (*index != *(index_next)) {
        index = X.erase(index, index_next2);
        count_this_time += 2;
      } else {
        index++;
      }
    }
    count_all += count_this_time;
    if (count_this_time == 0) break;
  }
  cout << count_all << endl;
  return 0;
}
