#include <bits/stdc++.h>
using namespace std;
const int MaxN = 100000 + 5;
int N;
int A[MaxN], Next[MaxN], Pre[MaxN];
void init() {
  string S;
  cin >> S;
  N = S.length();
  for (int i = 0; i < N; ++i) A[i + 1] = S[i] - '0';
  for (int i = 1; i <= N; ++i) Next[i] = i + 1, Pre[i] = i - 1;
  Next[0] = 1, Pre[N + 1] = N;
}
void solve() {
  bool update = true;
  int ans = 0;
  while (update) {
    update = false;
    for (int i = Next[0]; Next[i] != N + 1; i = Next[i]) {
      int j = Next[i];
      if (A[i] != A[j]) {
        ans += 2;
        Next[Pre[i]] = Next[j];
        Pre[Next[j]] = Pre[i];
        i = Next[i];
        update = true;
      }
    }
  }
  cout << ans << endl;
}
int main() {
  init();
  solve();
  return 0;
}
