#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int one = 0, zero = 0;
  bool f = true;
  if (s[0] != '1') {
    f = false;
    zero++;
  } else
    one++;
  int ans = 0;
  for (int i = 1; i < s.size(); i++) {
    if (s[i] == '1' && f)
      one++;
    else if (s[i] == '1' && !f) {
      zero--;
      ans += 2;
      if (zero == 0) {
        i++;
        if (s[i] == '1') {
          f = true;
          one = 1;
        } else {
          f = false;
          zero = 0;
        }
      }
    } else if (s[i] == '0' && f) {
      one--;
      ans += 2;
      if (one == 0) {
        i++;
        if (s[i] == '1') {
          f = true;
          one = 1;
        } else {
          f = false;
          zero = 0;
        }
      }
    } else {
      zero++;
    }
  }
  cout << ans << endl;
  return 0;
}
