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