#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  bool erased = false;
  int count = 0;
  do {
    erased = false;
    for (int i = 0; i < s.length() - 1; i++) {
      if (s[i] != s[i + 1]) {
        s.erase(i, 2);
        erased = true;
        count += 2;
        i -= 2;
      }
    }
  } while (erased);
  cout << count;
  return 0;
}
