#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long INF = 1LL << 60;
int main() {
  string S;
  cin >> S;
  int ssize = S.size();
  int counter = 0;
  vector<bool> flag(ssize, true);
  for (int i = 0; i < ssize - 1; i++) {
    if (!flag.at(i)) continue;
    int next = -1;
    for (int j = i + 1; j < ssize; j++) {
      if (flag.at(j)) {
        next = j;
        break;
      }
    }
    if (next == -1) break;
    if (S.at(i) != S.at(next)) {
      flag.at(i) = false;
      flag.at(next) = false;
      counter += 2;
      i = -1;
    }
  }
  cout << counter << endl;
}
