# -*- coding:utf-8 -*-
import sys


def cross_section_diagram(diagram):
    stack = []
    area = []
    for i, ch in enumerate(diagram):
        if ch == "\\":
            stack.append(i)
        elif ch == "/":
            if stack:
                point = stack.pop()
                area.insert(0, (point, i - point))
        else:
            pass
    result = []
    if area:
        p1, cnt1 = area.pop(0)
        for p2, cnt2 in area:
            if p1 < p2:
                cnt1 += cnt2
            else:
                result.insert(0, cnt1)
                p1 = p2
                cnt1 = cnt2
        result.insert(0, cnt1)

    print(sum(result))
    result.insert(0, len(result))
    print(" ".join([str(n)for n in result]))
    return result


if __name__ == "__main__":
    diagram = [val for val in sys.stdin.read().splitlines()]
    cross_section_diagram(diagram[0]) import sys sys def cross_section_diagram(diagram):
    stack = []
    area = []
    for i, ch in enumerate(diagram):
        if ch == "\\":
            stack.append(i)
        elif ch == "/":
            if stack:
                point = stack.pop()
                area.insert(0, (point, i - point))
        else:
            pass
    result = []
    if area:
        p1, cnt1 = area.pop(0)
        for p2, cnt2 in area:
            if p1 < p2:
                cnt1 += cnt2
            else:
                result.insert(0, cnt1)
                p1 = p2
                cnt1 = cnt2
        result.insert(0, cnt1)

    print(sum(result))
    result.insert(0, len(result))
    print(" ".join([str(n)for n in result]))
    return result cross_section_diagram stack = [] stack [] area = [] area [] for i, ch in enumerate(diagram):
        if ch == "\\":
            stack.append(i)
        elif ch == "/":
            if stack:
                point = stack.pop()
                area.insert(0, (point, i - point))
        else:
            pass
     i ch enumerate(diagram) enumerate diagram if ch == "\\":
            stack.append(i)
        elif ch == "/":
            if stack:
                point = stack.pop()
                area.insert(0, (point, i - point))
        else:
            pass
     ch == "\\" ch "\\" stack.append(i) stack.append stack append i elif ch == "/":
            if stack:
                point = stack.pop()
                area.insert(0, (point, i - point))
         ch == "/" ch "/" if stack:
                point = stack.pop()
                area.insert(0, (point, i - point))
         stack point = stack.pop() point stack.pop() stack.pop stack pop area.insert(0, (point, i - point)) area.insert area insert 0 (point, i - point) point i - point i point result = [] result [] if area:
        p1, cnt1 = area.pop(0)
        for p2, cnt2 in area:
            if p1 < p2:
                cnt1 += cnt2
            else:
                result.insert(0, cnt1)
                p1 = p2
                cnt1 = cnt2
        result.insert(0, cnt1)

     area p1, cnt1 = area.pop(0) p1 area.pop(0) area.pop area pop 0 cnt1 for p2, cnt2 in area:
            if p1 < p2:
                cnt1 += cnt2
            else:
                result.insert(0, cnt1)
                p1 = p2
                cnt1 = cnt2
         p2 cnt2 area if p1 < p2:
                cnt1 += cnt2
            else:
                result.insert(0, cnt1)
                p1 = p2
                cnt1 = cnt2
         p1 < p2 p1 p2 cnt1 += cnt2 cnt1 cnt2 result.insert(0, cnt1) result.insert result insert 0 cnt1 p1 = p2 p1 p2 cnt1 = cnt2 cnt1 cnt2 result.insert(0, cnt1) result.insert result insert 0 cnt1 print(sum(result)) print sum(result) sum result result.insert(0, len(result)) result.insert result insert 0 len(result) len result str(n)for n in result for n in result n result for n in result str(n) str n print(" ".join([str(n)for n in result])) print " ".join([str(n)for n in result]) " ".join " " join [str(n)for n in result] return result result diagram diagram if __name__ == "__main__":
    diagram = [val for val in sys.stdin.read().splitlines()]
    cross_section_diagram(diagram[0]) __name__ == "__main__" __name__ "__main__" val for val in sys.stdin.read().splitlines() for val in sys.stdin.read().splitlines() val sys.stdin.read().splitlines() sys.stdin.read().splitlines sys.stdin.read() sys.stdin.read sys.stdin sys stdin read splitlines for val in sys.stdin.read().splitlines() val diagram = [val for val in sys.stdin.read().splitlines()] diagram [val for val in sys.stdin.read().splitlines()] cross_section_diagram(diagram[0]) cross_section_diagram diagram[0] diagram 0 def cross_section_diagram(diagram):
    stack = []
    area = []
    for i, ch in enumerate(diagram):
        if ch == "\\":
            stack.append(i)
        elif ch == "/":
            if stack:
                point = stack.pop()
                area.insert(0, (point, i - point))
        else:
            pass
    result = []
    if area:
        p1, cnt1 = area.pop(0)
        for p2, cnt2 in area:
            if p1 < p2:
                cnt1 += cnt2
            else:
                result.insert(0, cnt1)
                p1 = p2
                cnt1 = cnt2
        result.insert(0, cnt1)

    print(sum(result))
    result.insert(0, len(result))
    print(" ".join([str(n)for n in result]))
    return result def cross_section_diagram(diagram):
    stack = []
    area = []
    for i, ch in enumerate(diagram):
        if ch == "\\":
            stack.append(i)
        elif ch == "/":
            if stack:
                point = stack.pop()
                area.insert(0, (point, i - point))
        else:
            pass
    result = []
    if area:
        p1, cnt1 = area.pop(0)
        for p2, cnt2 in area:
            if p1 < p2:
                cnt1 += cnt2
            else:
                result.insert(0, cnt1)
                p1 = p2
                cnt1 = cnt2
        result.insert(0, cnt1)

    print(sum(result))
    result.insert(0, len(result))
    print(" ".join([str(n)for n in result]))
    return result cross_section_diagram diagram = [val for val in sys.stdin.read().splitlines()] [val for val in sys.stdin.read().splitlines()] diagram
# -*- coding:utf-8 -*-
import sys


def cross_section_diagram(diagram):
    stack = []
    area = []
    for i, ch in enumerate(diagram):
        if ch == "\\":
            stack.append(i)
        elif ch == "/":
            if stack:
                point = stack.pop()
                area.insert(0, (point, i - point))
        else:
            pass
    result = []
    if area:
        p1, cnt1 = area.pop(0)
        for p2, cnt2 in area:
            if p1 < p2:
                cnt1 += cnt2
            else:
                result.insert(0, cnt1)
                p1 = p2
                cnt1 = cnt2
        result.insert(0, cnt1)

    print(sum(result))
    result.insert(0, len(result))
    print(" ".join([str(n)for n in result]))
    return result


if __name__ == "__main__":
    diagram = [val for val in sys.stdin.read().splitlines()]
    cross_section_diagram(diagram[0])