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