Source Code
#include <iostream>
#include <algorithm>
#include <iterator>
#include <math.h>
#include <vector>
#include <set>
#include <map>
using namespace std;
vector<long long>v;
long long n, t, x, y, z, c;
int main() {
	string s;
	cin >> s;
	c = z =0;
	for (int i = 0; i < s.size(); i++){
		if (s[i] == '1'){
			if (z == 1) c++;
			z = 0;
			c++;
		}
		else z++;
	}
	cout << c;
	return 0;
}
Copy
Japanese holidays Sarah
GNU G++17
1 ms
540 KB
Wrong Answer