#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long;
int main() {
  string S;
  cin >> S;
  int result = 0;
  int buf;
  do {
    buf = 0;
    if (S.empty()) {
      break;
    }
    for (int i = 0; i < S.size() - 1; ++i) {
      char cur_s = S[i];
      char next_s = S[i + 1];
      if (cur_s != next_s) {
        buf += 2;
        S.erase(S.begin() + i, S.begin() + i + 2);
        if (S.empty()) {
          break;
        }
      }
    }
    result += buf;
  } while (buf != 0);
  cout << result << endl;
}
