#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int SIZE = S.size();
  int sub = 0;
  vector<char> s;
  for (int i = 0; i < SIZE; i++) {
    s.push_back(S[i]);
  }
  for (int i = 0; (i + 1) < s.size(); i++) {
    if (s[i] != s[i + 1]) {
      sub += 2;
      s.erase(s.begin() + i, s.begin() + i + 2);
      if (i != 0) {
        i -= 2;
      }
    }
  }
  cout << sub << endl;
}
