#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define pb push_back
#define pf push_front
#define eb emplace_back
#define rep(i, b, n) for(int i=b; i < n ; i++)
#define rev(i, n, b) for(int i = n; i>= b; i--)
#define ll long long
#define F first
#define S second
#define endl "\n"
#define int ll
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define ali "Alice."
#define bob "Bob."
#define OO 0x3f3f3f3f3f3f3f3f
int dx[] = {+0, +0, -1, +1, +1, +1, -1, -1};
int dy[] = {-1, +1, +0, +0, +1, -1, +1, -1};
int kdx[] = {2, 1, -1, -2, -2, -1, 1, 2};
int kdy[] = {1, 2, 2, 1, -1, -2, -2, -1};
const double Pi = 3.14159265358979323846264;
bool cmp(const pair<int, int> &a, const pair<int, int> &b) {
return a.second > b.second;
}
const int mod = 1e9 + 7, N = 1e5;
void solve() {
string s; cin >> s;
int cnt(0);
for(auto i : s) {
if(i == '1') cnt++;
}
for(int i = 1; i < s.size()-1; i++){
if(s[i] == '0' and s[i-1] == '1' and s[i+1] == '1') cnt++;
}
cout << cnt <<endl;
}
signed main() {
ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
#ifdef Clion
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int t(1);
// cin >> t;
for (int i = 1; i <= t; i++) {
// cout << "Case #" << i << ":"<< endl;
solve();
}
}
Copy