#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  stack<char> st;
  for (int i = (0); i < (s.size()); i++) {
    if (st.top() != s[i])
      st.pop();
    else
      st.push(s[i]);
  }
  cout << (s.size() - st.size()) << '\n';
  return 0;
}
