#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int aaa, long long int bbb) {
  if (bbb == 0) {
    return aaa;
  }
  return gcd(bbb, aaa % bbb);
}
long long int lcm(long long int m, long long int n) {
  if ((0 == m) || (0 == n)) return 0;
  return ((m / gcd(m, n)) * n);
}
int main() {
  string S;
  cin >> S;
  long ans = 0, r = 0, b = 0, count = 0;
  if (S[0] == '0') {
    r++;
  } else {
    b++;
  }
  for (long i = 1; i < S.size(); i++) {
    if (S[i] == '0') {
      r++;
    } else {
      b++;
    }
    if (S[i] != S[i - 1]) {
      if (count == 1) {
        ans += min(r, b) * 2;
        if (r < b) {
          r = 0;
          b -= r;
        }
        count = 0;
      } else {
        count++;
      }
    }
  }
  if (count = 1) {
    ans += min(r, b) * 2;
  }
  cout << ans << endl;
  return 0;
}
