#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  int count_0 = 0, count_1 = 0, count;
  bool take;
  take = false;
  cin >> str;
  if (str[0] == '0') {
    count_0++;
  } else {
    count_1++;
  }
  for (int i = 1; i < (int)str.length(); i++) {
    if (str[i] == '0') {
      count_0 += 1;
      if (take) {
        if (count_1 > 0) {
          count += 2;
          count_1 -= 1;
          count_0 -= 1;
        } else {
          take = false;
        }
      } else if (str[i - 1] == '1') {
        count += 2;
        count_0--;
        count_1--;
        take = true;
      } else {
        take = false;
      }
    } else {
      count_1 += 1;
      if (take) {
        if (count_0 > 0) {
          count += 2;
          count_1 -= 1;
          count_0 -= 1;
        } else {
          take = false;
        }
      } else if (str[i - 1] == '0') {
        count += 2;
        count_0--;
        count_1--;
        take = true;
      } else {
        take = false;
      }
    }
  }
  cout << count << endl;
  return 0;
}
