#include <bits/stdc++.h>
using namespace std;
int pow(int a, int b) {
  int ans = 1;
  for (int i = 0; i < b; i++) ans *= a;
  return ans;
}
int main() {
  string S;
  cin >> S;
  int ans = 0;
  while (true) {
    int aa = 0;
    for (int i = 0; i < S.size() - 1;) {
      if (S[i] != S[i + 1]) {
        S.erase(S.begin() + i);
        S.erase(S.begin() + i);
        aa += 2;
        cerr << S << endl;
      } else {
        i++;
      }
    }
    if (aa == 0) break;
    ans += aa;
  }
  cout << ans;
  return 0;
}
