#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string S;
  cin >> S;
  vector<bool> check = vector<bool>(S.size(), true);
  bool loop = true;
  int result = 0;
  while (loop) {
    loop = false;
    for (int index = 0; index < S.size();) {
      int nextIndex = -1;
      for (int next = index + 1; next < S.size(); ++next) {
        if (check[next]) {
          nextIndex = next;
          break;
        }
      }
      if (nextIndex == -1) {
        break;
      }
      if (S[index] != S[nextIndex]) {
        result += 2;
        check[index] = false;
        check[nextIndex] = false;
        loop = true;
        int nextnextIndex = -1;
        for (int next = nextIndex + 1; next < S.size(); ++next) {
          if (check[next]) {
            nextnextIndex = next;
            break;
          }
        }
        if (nextnextIndex == -1) {
          break;
        }
        index = nextnextIndex;
      } else {
        index = nextIndex;
      }
    }
  }
  cout << result << endl;
  return 0;
}
