#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
void solve(string S) {
  ll c = 0;
  bool found;
  ll foundAt = 1;
  while (!S.empty() && found) {
    found = false;
    for (int i = foundAt - 1; i < S.size() - 1; i++) {
      found = S.at(i) != S.at(i + 1);
      foundAt = i;
      if (found) {
        S.erase(i, 2);
        c += 2;
        break;
      }
    }
  }
  cout << c << endl;
}
int main() {
  string S;
  cin >> S;
  solve(S);
  return 0;
}
