#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int ans = 0;
  while (true) {
    int n = s.size();
    if (n <= 1) break;
    bool cont = true;
    for (int i = 0; i < n - 1; i++) {
      if (s.at(i) != s.at(i + 1)) {
        ans += 2;
        s.erase(i, 2);
        if (s == "") cont = false;
        break;
      }
      if (i == n - 2) cont = false;
    }
    if (!cont) break;
  }
  cout << ans << endl;
  return 0;
}
