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