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