#include <bits/stdc++.h>
using namespace std;
static const int INF = INT_MAX;
static const long long LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const long long LMIN = LLONG_MIN;
static const int MOD = 1000000007;
int dx[] = {0, -1, 1, 0};
int dy[] = {-1, 0, 0, 1};
int zcnt[100005];
int ocnt[100005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int zpos = -1, opos = -1;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == '1') {
      opos = i;
      if (i) ocnt[i] = ocnt[i - 1];
    } else {
      if (i)
        ocnt[i] = ocnt[i - 1] + 1;
      else
        ocnt[i] = 1;
    }
  }
  for (int i = s.size() - 1; i >= 0; --i) {
    if (s[i] == '0') {
      zpos = i;
      if (i != s.size() - 1) zcnt[i] = zcnt[i + 1];
    } else {
      if (i != s.size() - 1)
        zcnt[i] = zcnt[i + 1] + 1;
      else
        zcnt[i] = 1;
    }
  }
  if (zpos == -1 || opos == -1)
    cout << 0 << '\n';
  else
    cout << min(zcnt[zpos], ocnt[opos]) * 2 << '\n';
  return 0;
}
