#include <bits/stdc++.h>
using namespace std;
const long long LINF = 1LL << 60;
const int INF = 1001001001;
const int MOD = 1000000007;
int main() {
  string s;
  cin >> s;
  int l = s.size();
  int ans = 0;
  while (true) {
    bool check = true;
    for (int i = 0; i < (l - 1); i++) {
      if (s[i] != s[i + 1]) {
        s.erase(i, 2);
        ans += 2;
        l -= 2;
        check = false;
      }
    }
    if (check) break;
  }
  cout << ans << endl;
  return 0;
}
