#include <bits/stdc++.h>
using namespace std;
signed main() {
  string s;
  cin >> s;
  stack<char> st;
  for (long long i = 0; i < s.size(); i++) {
    if (st.size() == 0 || st.top() != s[i])
      st.push(s[i]);
    else
      st.pop();
  }
  cout << s.size() - st.size() << endl;
}
