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