#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  int res;
  stack<char> st;
  for (int i = (int)0; i < (int)n; ++i) {
    if (st.empty() || st.top() == s[i]) {
      st.push(s[i]);
    } else {
      res += 2;
      st.pop();
    }
  }
  cout << res << endl;
  return 0;
}
