#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  bool finished = false;
  int ans = 0;
  while (!finished && S.length() > 1) {
    bool tmp = true;
    for (int i = 0; i < (int)(S.length() - 1); i++) {
      if (S.at(i) != S.at(i + 1)) {
        ans += 2;
        S = S.substr(0, i) + S.substr(i + 2, S.length() - i - 2);
        tmp = false;
        break;
      }
    }
    if (tmp) finished = true;
  }
  cout << ans << endl;
}
