#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007;
const long long int INF = (long long int)1e15;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  long long int N = S.length();
  stack<long long int> s;
  for (long long int(i) = (0); (i) < (N); ++(i)) {
    if (s.size() > 0 && s.top() == S[i])
      s.pop();
    else
      s.push(S[i]);
  }
  cout << N - s.size() << endl;
  return 0;
}
