#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  vector<int> color_blue;
  int cnt = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(s.size() - 1 - i) == '1') cnt++;
    color_blue.push_back(cnt);
  }
  if (cnt == 0) {
    cout << 0 << endl;
    return 0;
  }
  reverse(color_blue.begin(), color_blue.end());
  cnt = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) == '0') cnt++;
  }
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) == '0') {
      if (cnt <= color_blue[i]) {
        cout << cnt * 2 << endl;
        return 0;
      }
      cnt--;
    }
  }
}
