#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  long long prev = 0, top = -1, ans = 0;
  if (s[0] == '1') prev = 1;
  for (int i = 0; i < s.size() - 1; i++) {
    if (s[i + 1] == '0' && prev == 1) {
      ans += 2;
      if (top != -1) prev = top;
    } else if (s[i + 1] == '1' && prev == 0) {
      ans += 2;
      if (top != -1) prev = top;
    } else if (s[i + 1] == '0') {
      top = prev;
      prev = 0;
    } else {
      top = prev;
      prev = 1;
    }
  }
  cout << ans << endl;
  return 0;
}
