arr = list(input())
down = list()
areas = list()

for i, el in enumerate(arr):
    if el == "\\":
        down.append(i)
    elif el == "/" and not len(down) == 0:
        start_ind = down.pop()
        area = i - start_ind
        while len(areas) > 0 and areas[-1][0] > start_ind:
            area += areas.pop()[1]
        areas.append((start_ind, area))
    # print("LOOP: {}".format(i))
    # print("DOWN INDICES")
    # print(down)
    # print("AREAS")
    # print(areas)
    # print()

areas = [areas[i][1] for i in range(len(areas))]
print(sum(areas))
if len(areas) == 0:
    print("0")
else:
    print(len(areas), " ".join(map(str,areas))) arr = list(input()) arr list(input()) list input() input down = list() down list() list areas = list() areas list() list for i, el in enumerate(arr):
    if el == "\\":
        down.append(i)
    elif el == "/" and not len(down) == 0:
        start_ind = down.pop()
        area = i - start_ind
        while len(areas) > 0 and areas[-1][0] > start_ind:
            area += areas.pop()[1]
        areas.append((start_ind, area))
    # print("LOOP: {}".format(i))
    # print("DOWN INDICES")
    # print(down)
    # print("AREAS")
    # print(areas)
    # print() i el enumerate(arr) enumerate arr if el == "\\":
        down.append(i)
    elif el == "/" and not len(down) == 0:
        start_ind = down.pop()
        area = i - start_ind
        while len(areas) > 0 and areas[-1][0] > start_ind:
            area += areas.pop()[1]
        areas.append((start_ind, area))
    # print("LOOP: {}".format(i))
    # print("DOWN INDICES")
    # print(down)
    # print("AREAS")
    # print(areas)
    # print() el == "\\" el "\\" down.append(i) down.append down append i elif el == "/" and not len(down) == 0:
        start_ind = down.pop()
        area = i - start_ind
        while len(areas) > 0 and areas[-1][0] > start_ind:
            area += areas.pop()[1]
        areas.append((start_ind, area))
    # print("LOOP: {}".format(i))
    # print("DOWN INDICES")
    # print(down)
    # print("AREAS")
    # print(areas)
    # print() el == "/" and not len(down) == 0 el == "/" el "/" not len(down) == 0 len(down) == 0 len(down) len down 0 start_ind = down.pop() start_ind down.pop() down.pop down pop area = i - start_ind area i - start_ind i start_ind while len(areas) > 0 and areas[-1][0] > start_ind:
            area += areas.pop()[1]
         len(areas) > 0 and areas[-1][0] > start_ind len(areas) > 0 len(areas) len areas 0 areas[-1][0] > start_ind areas[-1][0] [-1] areas -1 0 start_ind area += areas.pop()[1] area areas.pop()[1] areas.pop() areas.pop areas pop 1 areas.append((start_ind, area)) areas.append areas append (start_ind, area) start_ind area areas[i][1] for i in range(len(areas)) for i in range(len(areas)) i range(len(areas)) range len(areas) len areas for i in range(len(areas)) areas[i][1] [i] areas i 1 areas = [areas[i][1] for i in range(len(areas))] areas [areas[i][1] for i in range(len(areas))] print(sum(areas)) print sum(areas) sum areas if len(areas) == 0:
    print("0")
else:
    print(len(areas), " ".join(map(str,areas))) len(areas) == 0 len(areas) len areas 0 print("0") print "0" print(len(areas), " ".join(map(str,areas))) print len(areas) len areas " ".join(map(str,areas)) " ".join " " join map(str,areas) map str areas down = list() list() down area = i - start_ind i - start_ind area area += areas.pop()[1] areas.pop()[1] area start_ind = down.pop() down.pop() start_ind arr = list(input()) list(input()) arr areas = [areas[i][1] for i in range(len(areas))] [areas[i][1] for i in range(len(areas))] areas areas = list() list() areas
arr = list(input())
down = list()
areas = list()

for i, el in enumerate(arr):
    if el == "\\":
        down.append(i)
    elif el == "/" and not len(down) == 0:
        start_ind = down.pop()
        area = i - start_ind
        while len(areas) > 0 and areas[-1][0] > start_ind:
            area += areas.pop()[1]
        areas.append((start_ind, area))
    # print("LOOP: {}".format(i))
    # print("DOWN INDICES")
    # print(down)
    # print("AREAS")
    # print(areas)
    # print()

areas = [areas[i][1] for i in range(len(areas))]
print(sum(areas))
if len(areas) == 0:
    print("0")
else:
    print(len(areas), " ".join(map(str,areas)))
