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