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