#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string s;
  cin >> s;
  int sum = 0;
  int i = 0;
  while (i < s.length() && (i + 1) < s.length()) {
    const char before = s[i];
    const char after = s[i + 1];
    if (before != after) {
      sum += 2;
      s.erase(i, 2);
      i = 0;
      continue;
    }
    i++;
  }
  cout << sum << endl;
  return 0;
}
