Source Code
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void MOUST(){
    ios_base::sync_with_stdio(0);
           cin.tie(0);
}
int main(){
    MOUST();

    ll b=0;
    string j;cin>>j;
    j+="##";
    for(int i=0;i<j.length();i++){
        if(j[i]=='1'&&j[i+1]=='0'&&j[i+2]=='1')
            b++;
        if(j[i]=='1')
            b++;
    }
    cout<<b;
}
Copy
Japanese holidays call911kid
GNU G++17
2 ms
496 KB
Accepted