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