#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int cnt = 0;
  for (int i = 0; S.size() > 1 && i < S.size() - 1;) {
    if (S.at(i) != S.at(i + 1)) {
      S.erase(S.begin() + i, S.begin() + i + 2);
      cnt += 2;
      i = 0;
      continue;
    }
    i++;
  }
  cout << cnt << endl;
  return 0;
}
