#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int ans = 0;
  bool continue_flg = true;
  while (continue_flg) {
    continue_flg = false;
    if (S.size() == 1) break;
    for (int i = S.size() - 1; i >= 0; i--) {
      if (S[i] != S[i - 1]) {
        if (S.size() != 2) {
          continue_flg = true;
          S.erase(S.begin() + i);
          S.erase(S.begin() + i - 1);
        }
        ans += 2;
        break;
      }
      if (S.size() == 2) break;
    }
  }
  cout << ans << endl;
  return 0;
}
