#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  int ans = 0;
  int frag = 1;
  while (frag) {
    frag = 0;
    if (S.size() == 0 || S.size() == 1) {
      break;
    }
    for (int i = 0; i < S.size() - 1; i++) {
      if (S[i] != S[i + 1]) {
        S.erase(S.begin() + i);
        S.erase(S.begin() + i);
        ans++;
        frag = true;
      }
      if (S.size() == 0 || S.size() == 1) {
        break;
      }
    }
  }
  cout << ans * 2 << endl;
  return 0;
}
