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