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