#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<sstream>
using namespace std;
int main()
{
string input;
getline(cin, input);
vector<string> nums;
string token;
stringstream ss(input);
while(getline(ss, token, ','))
{
nums.push_back(token);
}
double count = 0;
int result = 0;
int len = nums.size();
for(int i = 0; i < len; i++)
{
if(nums[i] == "1")
{
if(count > 1)
{
result += ceil((count - 2) / 2);
}
count = 0;
}
else
{
if(i == 0 || i == len - 1)
{
count++;
}
count++;
}
}
if(count > 1)
{
result += ceil((count - 2) / 2);
}
if(len == 1 && nums[0] == "0")
{
result = 1;
}
cout << result << endl;
return 0;
}