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