#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  std::cout.unsetf(std::ios::floatfield);
  std::cout.precision(10);
  long long a, b, c, d, e, x, i, j, n, t, m, k, y;
  double p, q, r, w, u;
  string str = "", str1 = "";
  long long a1, a2, b1, b2;
  cin >> str;
  n = str.size();
  c = 0;
  a = 0;
  for (i = 0; i < n; i = i + 1) {
    if (str[i] == '0' && str[i + 1] == '1') {
      c++;
      i++;
    } else if (str[i] == '0') {
      a++;
    } else if (a > 0) {
      c++;
      a--;
    }
  }
  cout << c * 2;
}
