input = gets.chomp

height = 0
$heightArr = []
$areaArr = []
$same = -1
$down = 0

def whatArea
    area = 0
    for i in $down+1..$same do
        area += $heightArr[$down] - $heightArr[i]
    end
    $areaArr << area
end


input.each_char {|c|
    $heightArr << height
    if c == '\\'
        height -= 1
    elsif c == '/'
        height += 1
    end
}
$heightArr << height

loop {
    nextDown = input[$same+1..-1].index('\\')
    if nextDown == nil
        break
    else
        $down = $same + nextDown + 1
    end

    nextSame = $heightArr[$down+1..-1].index($heightArr[$down])
    if nextSame == nil
        $same = $same + 1
    else
        $same = $down + nextSame
        whatArea
    end
}
puts $areaArr.inject(:+)
print $areaArr.size, ' ', $areaArr * ' ' , "\n"