#include <bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = std::vector<T>;
template <class T>
using vvec = vec<vec<T>>;
constexpr std::size_t operator""_sz(ull n) { return std::size_t(n); }
int main() {
  using namespace std;
  string s;
  cin >> s;
  list<char> li;
  copy(s.begin(), s.end(), back_inserter(li));
  ll ans{};
  while (true) {
    bool removed{};
    for (auto it = li.begin(); next(it) != li.end(); ++it) {
      if (*it != *next(it)) {
        removed = true;
        li.erase(next(it));
        li.erase(it);
        break;
      }
    }
    if (removed) {
      ans += 2;
    } else {
      break;
    }
  }
  cout << ans << endl;
  return 0;
}
