#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
const long long INFLL = 1LL << 60;
const int INFI = 1000000000;
int main() {
  string S;
  cin >> S;
  int ans = 0;
  int i = 0;
  while (true) {
    if (i + 2 >= S.size()) break;
    if (S[i] != S[i + 1]) {
      ans += 2;
      S.erase(i, 2);
      i = 0;
      continue;
    }
    i++;
  }
  cout << ans << endl;
}
