#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f;
const int N = 100000 + 50;
int arry[N] = {0};
int main() {
  char a[N];
  gets(a);
  int n = strlen(a);
  int sum = 0;
  stack<char> st;
  st.push(a[0]);
  for (int i = 1; i < n; i++) {
    if (st.empty()) {
      st.push(a[i]);
    } else if (a[i] == st.top()) {
      st.push(a[i]);
    } else {
      st.pop();
      sum++;
    }
  }
  cout << sum * 2 << endl;
}
