#include <bits/stdc++.h>
using namespace std;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
const int INF = INT_MAX;
const long long LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  string s;
  cin >> s;
  int n = s.length();
  int ans1 = 0;
  int ans2 = 0;
  int count = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '1') {
      count++;
    } else if (s[i] == '0' && count >= 1) {
      ans1++;
    }
  }
  count = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '0') {
      count++;
    } else if (s[i] == '1' && count >= 1) {
      ans2++;
    }
  }
  int ans = max(2 * ans1, 2 * ans2);
  cout << ans << endl;
  return 0;
}
