#include <bits/stdc++.h>
using namespace std;
int n;
signed main() {
  string s;
  cin >> s;
  char c[100001];
  c[0] = s[0];
  int k = 0, ret = 0;
  for (int i = 1; i < s.size(); i++) {
    if (s[i] == c[k]) {
      ret += 2;
      k = max(k - 1, 0);
    } else {
      k++;
      c[k] = s[i];
    }
  }
  cout << ret << endl;
  return 0;
}
