const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
});
readline.on('line', (input) => {
const inputArray = input.split(',');
const inputString = inputArray.join('');
const parking_slots = inputString.split('0');
let min_cars = 0;
for (const slot of parking_slots) {
const occupied_length = slot.length;
if (occupied_length === 0) {
min_cars = min_cars;
}
else if (occupied_length % 3 === 0 && occupied_length !== 0) {
min_cars += Math.floor(occupied_length / 3);
}
else if (occupied_length % 3 !== 0) {
min_cars += Math.floor((occupied_length - occupied_length % 3) / 3);
min_cars += 1;
}
}
console.log(min_cars);
readline.close();
});