#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
const long long MOD = (long long)1e9 + 7;
signed main() {
  string s;
  cin >> s;
  stack<char> st;
  long long sum = 0;
  st.push(s[0]);
  for (long long i = 1; i < s.size(); ++i) {
    if (st.empty() || st.top() == s[i]) {
      st.push(s[i]);
    } else {
      st.pop();
      sum += 2;
    }
  }
  cout << sum << "\n";
}
