#include <bits/stdc++.h>
using namespace std;
int main() {
  std::string S;
  cin >> S;
  int cnt = 0;
  int N = S.length();
  for (cnt = 0; cnt < N / 2; cnt++) {
    bool f = true;
    for (int i = 0; i < N - 1; i++) {
      if (S[i] != S[i + 1]) {
        S.erase(S.begin() + i);
        S.erase(S.begin() + i);
        f = false;
        break;
      }
    }
    if (f) break;
  }
  cout << cnt * 2 << endl;
  return 0;
}
