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