function main(_stdin) {
    const stdin = _stdin.trim().split('');

    const points = [];
    const lakes = [];

    points.push({x:0, y:0, end: 0});
    for (let ref = 0, l = stdin.length; ref < l; ref++) {
        const r = points[ref];
        if (stdin[ref] === '\\') {
            points.push({x: r.x + 1, y: r.y - 1, end: 0});
        } else if (stdin[ref] === '/') {
            points.push({x: r.x + 1, y: r.y + 1, end: 1});
        } else {
            points.push({x: r.x + 1, y: r.y, end: 0});
        }
    }

    let l = points.length-1;
    while(l) {
        if (points[l].end === 1) {
            let i = l - 1;
            while(i > 0  && points[l].y !== points[i].y) {
                i--;
            }
            if (points[i].y === points[l].y) {
                lakes.push(points.slice(i, l + 1));
                l = i;
            } else {
                l--;
            }
        } else {
            l--;
        }
    }

    const vol = lakes.length;
    const areas = lakes.map(points => {
        const zeroDiff = 0 - points[0].y;
        let cnts = 0;
        for (let i = 1, l = points.length; i < l; i++) {
            const ref = points[i-1];
            const diff = Math.abs(points[i].y + zeroDiff);
            // 下がっている
            if (ref.y > points[i].y) {
                cnts += diff - 1 + 0.5;
            } else if (ref.y < points[i].y){
                cnts += diff + 0.5;
            } else {
                cnts += diff;
            }
        }
        return cnts;
    });


    const total = areas.length ? areas.reduce((a, b) => a+b) : 0;
    console.log(total);
    areas.push(vol);
    console.log(areas.reverse().join(' '));
}


main(require('fs').readFileSync('/dev/stdin', 'utf8'));


