#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}
using ll = long long int;
int main(void) {
  string s;
  string t;
  int c = 0;
  cin >> s;
  t.push_back(s[0]);
  for (auto i = s.begin() + 1; i != s.end(); i++) {
    if (t.size() == 0 or s[0] == *i) {
      t.push_back(*i);
    } else {
      t.pop_back();
      c++;
    }
  }
  std::cout << c * 2 << std::endl;
  return 0;
}
