#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0;
  string S;
  cin >> S;
  vector<int> vS(S.size());
  int flag = 0;
  for (int i = 0; i < S.size(); i++) {
    vS[i] = S[i];
  }
  while (1) {
    if (vS.size() == 1 || vS.size() == 0) {
      break;
    }
    for (int i = 0; i < vS.size(); i++) {
      if (vS[i] != vS[i + 1]) {
        vS.erase(vS.begin() + i);
        vS.erase(vS.begin() + i);
        ans++;
        flag++;
        break;
      }
    }
    if (flag != 0) {
      flag = 0;
      continue;
    } else {
      break;
    }
  }
  cout << ans * 2 << endl;
  return 0;
}
