#include <bits/stdc++.h>

using namespace std;

int solve(std::vector<char>& ss) {
  if (ss.size() <= 1) {
    return 0;
  }
  int ret = 0;
  int firstRemoved = 0;
  int lastRemoved = ss.size();
  do {
    int const begin = std::max(0, firstRemoved - 1);
    int const end = std::min(int(ss.size()), lastRemoved + 1);
    firstRemoved = -1;
    lastRemoved = 10000000;
    for (int i = begin; i + 1 < std::min(int(ss.size()), end);) {
      if (ss[i] != ss[i + 1]) {
        ss.erase(ss.begin() + i, ss.begin() + i + 2);
        if (firstRemoved < 0) {
          firstRemoved = i;
        }
        lastRemoved = i;
        ret += 2;
      } else {
        ++i;
      }
    }
  } while (firstRemoved >= 0 && ss.size() > 1);
  return ret;
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  std::string s;
  std::cin >> s;
  std::vector<char> ss;
  for (auto ch : s) {
    ss.push_back(static_cast<std::__1::vector<char, class std::__1::allocator<char> >::value_type>(ch == '1'));
  }
  std::cout << solve(ss) << std::endl;
  return 0;
}
