#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, i, count = 0, end = 0;
  string s;
  cin >> s;
  n = s.length();
  do {
    end = 1;
    for (i = 0; i < n - 1; i++) {
      if (s[i] != s[i + 1]) {
        count++;
        end = 0;
        s.erase(s.begin() + i, s.begin() + i + 1);
        n = n - 2;
      }
    }
  } while (end != 1);
  cout << 2 * count << endl;
  return 0;
}
