#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < s.length() - 1; i++) {
    if (s.at(i) != s.at(i + 1)) {
      ans += 2;
      s.erase(i, 2);
      i = -1;
    }
    if (s.length() == 0) {
      break;
    }
  }
  cout << ans << endl;
  return 0;
}
