#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int count = 0;
  bool done = true;
  while (done) {
    done = false;
    for (unsigned int i = 0; i < s.size() - 1; i++) {
      if (s[i] != s[i + 1]) {
        s.erase(s.begin() + i);
        s.erase(s.begin() + i);
        count += 2;
        done = true;
      }
    }
  }
  cout << count;
}
