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