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