#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int i, a;
  string s;
  cin >> s;
  i = a = 0;
  while (i < s.length()) {
    if (s[i] != s[i + 1] && s.length() > 1) {
      s.erase(i, 2);
      i--;
      a += 2;
    }
    i++;
  }
  cout << a << endl;
  return 0;
}
