#include typedef long long ll; typedef std::pair P; typedef std::priority_queue, std::greater

> PQ; int main() { std::string s; std::cin >> s; int n = s.length(); int ans = 0; for (int i = n - 1; i >= 2; --i) { if (s[i] == '0' && s[i - 1] == '1' && s[i - 2] == '1') { s[i] = '1'; s[i - 2] = '0'; ans++; i += 2; if (i > n) i = n; // std::cout << s << std::endl; } } std::cout << ans << std::endl; }