from sys import stdin
from collections import deque

def main():
    point = 0
    watermarks = []
    ponds = []

    for mark in list(stdin.readline()):
        point += 1
        if mark == "\\":
            watermarks.append(point)
        elif mark == "/":
            if watermarks:
                start_point = watermarks.pop()
                area = point - start_point
                while ponds and ponds[-1][0] > start_point:
                    area += ponds.pop()[1]
                ponds.append((start_point, area))

    pond_list = [pond[1] for pond in ponds]
    print(sum(pond_list))
    print(len(pond_list), *pond_list)

main() from sys import stdin from collections import deque def main():
    point = 0
    watermarks = []
    ponds = []

    for mark in list(stdin.readline()):
        point += 1
        if mark == "\\":
            watermarks.append(point)
        elif mark == "/":
            if watermarks:
                start_point = watermarks.pop()
                area = point - start_point
                while ponds and ponds[-1][0] > start_point:
                    area += ponds.pop()[1]
                ponds.append((start_point, area))

    pond_list = [pond[1] for pond in ponds]
    print(sum(pond_list))
    print(len(pond_list), *pond_list) main point = 0 point 0 watermarks = [] watermarks [] ponds = [] ponds [] for mark in list(stdin.readline()):
        point += 1
        if mark == "\\":
            watermarks.append(point)
        elif mark == "/":
            if watermarks:
                start_point = watermarks.pop()
                area = point - start_point
                while ponds and ponds[-1][0] > start_point:
                    area += ponds.pop()[1]
                ponds.append((start_point, area))

     mark list(stdin.readline()) list stdin.readline() stdin.readline stdin readline point += 1 point 1 if mark == "\\":
            watermarks.append(point)
        elif mark == "/":
            if watermarks:
                start_point = watermarks.pop()
                area = point - start_point
                while ponds and ponds[-1][0] > start_point:
                    area += ponds.pop()[1]
                ponds.append((start_point, area))

     mark == "\\" mark "\\" watermarks.append(point) watermarks.append watermarks append point elif mark == "/":
            if watermarks:
                start_point = watermarks.pop()
                area = point - start_point
                while ponds and ponds[-1][0] > start_point:
                    area += ponds.pop()[1]
                ponds.append((start_point, area))

     mark == "/" mark "/" if watermarks:
                start_point = watermarks.pop()
                area = point - start_point
                while ponds and ponds[-1][0] > start_point:
                    area += ponds.pop()[1]
                ponds.append((start_point, area))

     watermarks start_point = watermarks.pop() start_point watermarks.pop() watermarks.pop watermarks pop area = point - start_point area point - start_point point start_point while ponds and ponds[-1][0] > start_point:
                    area += ponds.pop()[1]
                 ponds and ponds[-1][0] > start_point ponds ponds[-1][0] > start_point ponds[-1][0] [-1] ponds -1 0 start_point area += ponds.pop()[1] area ponds.pop()[1] ponds.pop() ponds.pop ponds pop 1 ponds.append((start_point, area)) ponds.append ponds append (start_point, area) start_point area pond[1] for pond in ponds for pond in ponds pond ponds for pond in ponds pond[1] pond 1 pond_list = [pond[1] for pond in ponds] pond_list [pond[1] for pond in ponds] print(sum(pond_list)) print sum(pond_list) sum pond_list print(len(pond_list), *pond_list) print len(pond_list) len pond_list *pond_list pond_list main() main def main():
    point = 0
    watermarks = []
    ponds = []

    for mark in list(stdin.readline()):
        point += 1
        if mark == "\\":
            watermarks.append(point)
        elif mark == "/":
            if watermarks:
                start_point = watermarks.pop()
                area = point - start_point
                while ponds and ponds[-1][0] > start_point:
                    area += ponds.pop()[1]
                ponds.append((start_point, area))

    pond_list = [pond[1] for pond in ponds]
    print(sum(pond_list))
    print(len(pond_list), *pond_list) def main():
    point = 0
    watermarks = []
    ponds = []

    for mark in list(stdin.readline()):
        point += 1
        if mark == "\\":
            watermarks.append(point)
        elif mark == "/":
            if watermarks:
                start_point = watermarks.pop()
                area = point - start_point
                while ponds and ponds[-1][0] > start_point:
                    area += ponds.pop()[1]
                ponds.append((start_point, area))

    pond_list = [pond[1] for pond in ponds]
    print(sum(pond_list))
    print(len(pond_list), *pond_list) main
from sys import stdin
from collections import deque

def main():
    point = 0
    watermarks = []
    ponds = []

    for mark in list(stdin.readline()):
        point += 1
        if mark == "\\":
            watermarks.append(point)
        elif mark == "/":
            if watermarks:
                start_point = watermarks.pop()
                area = point - start_point
                while ponds and ponds[-1][0] > start_point:
                    area += ponds.pop()[1]
                ponds.append((start_point, area))

    pond_list = [pond[1] for pond in ponds]
    print(sum(pond_list))
    print(len(pond_list), *pond_list)

main()
