Source Code
#include <iostream>
using namespace std;
string n;
int sum;
int main()
{
    cin>>n;
    for(int i=0;i<n.size();i++){
        if(n[i] == '1'){
            if(n[i+2] == '1' && n[i+1] == '0'){
                sum++;
            }
            sum++;
        }
    }
    cout<<sum<<endl;

    return 0;
}
Copy
Japanese holidays Rimawi
GNU G++17
2 ms
860 KB
Accepted