#include <bits/stdc++.h>
using namespace std;
int main() {
  long N, NN, count = 0;
  char pS;
  string S;
  cin >> S;
  while (N != S.length() && S.empty() == 0) {
    N = S.length();
    NN = S.length();
    pS = S[0];
    for (int i = 0; i < NN; i++) {
      if (pS != S[i]) {
        S.erase(S.begin() + i - 1, S.begin() + i + 1);
        i--;
        count += 2;
        NN = S.length();
      }
      pS = S[i];
    }
  }
  cout << count << endl;
  return 0;
}
