#include <bits/stdc++.h>   using namespace std;   int res;   int tox[] = {0, 0, 1, -1};   int toy[] = {1, -1, 0, 0};   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr), cout.tie(nullptr);     string s;     cin >> s;     while (s.back() ==  0 ) s.erase(s.size() - 1, 1), res++;     while (s !=  1 ) {       while (s.size() && s.back() ==  1 ) s.erase(s.size() - 1, 1), res++;       res++;       if (!s.size()) break;       s.back() =  1 ;     }     cout << res;     return 0;   }   