#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
  string S;
  cin >> S;
  int e = 0, ne = 0;
  do {
    ne = 0;
    int i = 0;
    while (i < int(S.size()) - 1) {
      if (S.at(i) != S.at(i + 1)) {
        S.erase(i, 2);
        e += 2;
        ne += 1;
      }
      i++;
    }
  } while (ne != 0);
  cout << e;
}
