#include <bits/stdc++.h>
int main() {
  std::string s;
  std::cin >> s;
  bool flg = false;
  long long counter = 0;
  while (1 < s.size() && !flg) {
    for (long long i = 0; i <= s.size() - 2; ++i) {
      if (s.at(i) != s.at(i + 1)) {
        s.erase(i, 2);
        counter += 2;
        break;
      } else if (s.size() - 2 == i) {
        flg = true;
        break;
      }
    }
  }
  std::cout << counter << std::endl;
  return 0;
}
