#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
int main() {
  string s;
  ll ans = 0, tmp = -1;
  bool flg;
  cin >> s;
  while (true) {
    flg = true;
    for (long i = 1; i < s.size(); i++) {
      if (s[i] != s[i - 1]) {
        s.erase(i - 1, 2);
        ans += 2;
        flg = false;
      }
    }
    if (flg) {
      break;
    }
  }
  cout << ans << '\n';
  return 0;
}
