#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int i = 0;
  int ans = 0;
  while (1) {
    if (str.size() == 0 || str.size() == i + 1) break;
    if (str[i] != str[i + 1]) {
      str.erase(i, 2);
      ans += 2;
      i -= (i == 0 ? 1 : 2);
    }
    i++;
  }
  cout << ans << endl;
  return 0;
}
