# 12. 找座位

12 12-1

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', (input) => {
    let max = 0;
    for(let i=0; i<input.length; i++) {
        if (input[i] === '0' && (i === 0 || input[i-1] === '0') && (i === input.length - 1 || input[i+1] === '0')) {
            max++;
            input = input.substr(0, i) + '1' + input.substr(i + 1);
            i++;
        }
    }
    console.log(max);
});

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18