#include using namespace std; int dp[200000][2]; int main() { string S; cin >> S; if (S[0] == '0') { dp[0][0] = 0; dp[0][1] = 1; } else { dp[0][0] = 1; dp[0][1] = 0; } for (int i = 1; i < S.size(); i++) { if (S[i] == '0') { dp[i][0] = min(dp[i - 1][0], min(i, dp[i - 1][1] + 3)); dp[i][1] = dp[i - 1][1] + 1; } else { dp[i][0] = min(dp[i - 1][0] + 1, dp[i - 1][1] + 2); dp[i][1] = dp[i - 1][1]; } } cout << min(dp[S.size() - 1][0], dp[S.size() - 1][0] + 2) << endl; }