#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  string S, S2;
  cin >> S;
  S2 = S;
  int ans = 0;
  for (int i = 0; i < S2.size() - 1; i++) {
    if (S2.size() <= 1) break;
    for (int j = 0; j < S2.size() - 1; j++) {
      if (S2.size() <= 1) break;
      if (S2.at(j) != S2.at(j + 1)) {
        S2.erase(S2.begin() + j);
        S2.erase(S2.begin() + j);
        ans += 2;
      }
    }
  }
  cout << ans << endl;
}
