cross_section = input()
visited = {0: -1}
height = 0
pools = []
for i, c in enumerate(cross_section):
    if c == '\\':
        height -= 1
    elif c == '/':
        height += 1
        if height in visited:
            width = i - visited[height]
            sm = 0
            while pools and pools[-1][0] > visited[height]:
                _, volume = pools.pop()
                sm += volume
            pools.append((i, sm + width - 1))
    visited[height] = i

print(sum(v for _, v in pools))
print(len(pools), *(v for _, v in pools)) cross_section = input() cross_section input() input visited = {0: -1} visited {0: -1} 0 0 -1 height = 0 height 0 pools = [] pools [] for i, c in enumerate(cross_section):
    if c == '\\':
        height -= 1
    elif c == '/':
        height += 1
        if height in visited:
            width = i - visited[height]
            sm = 0
            while pools and pools[-1][0] > visited[height]:
                _, volume = pools.pop()
                sm += volume
            pools.append((i, sm + width - 1))
    visited[height] = i i c enumerate(cross_section) enumerate cross_section if c == '\\':
        height -= 1
    elif c == '/':
        height += 1
        if height in visited:
            width = i - visited[height]
            sm = 0
            while pools and pools[-1][0] > visited[height]:
                _, volume = pools.pop()
                sm += volume
            pools.append((i, sm + width - 1))
     c == '\\' c '\\' height -= 1 height 1 elif c == '/':
        height += 1
        if height in visited:
            width = i - visited[height]
            sm = 0
            while pools and pools[-1][0] > visited[height]:
                _, volume = pools.pop()
                sm += volume
            pools.append((i, sm + width - 1))
     c == '/' c '/' height += 1 height 1 if height in visited:
            width = i - visited[height]
            sm = 0
            while pools and pools[-1][0] > visited[height]:
                _, volume = pools.pop()
                sm += volume
            pools.append((i, sm + width - 1))
     height in visited height visited width = i - visited[height] width i - visited[height] i visited[height] visited height sm = 0 sm 0 while pools and pools[-1][0] > visited[height]:
                _, volume = pools.pop()
                sm += volume
             pools and pools[-1][0] > visited[height] pools pools[-1][0] > visited[height] pools[-1][0] [-1] pools -1 0 visited[height] visited height _, volume = pools.pop() _ pools.pop() pools.pop pools pop volume sm += volume sm volume pools.append((i, sm + width - 1)) pools.append pools append (i, sm + width - 1) i sm + width - 1 sm + width sm width 1 visited[height] = i visited[height] visited height i print(sum(v for _, v in pools)) print sum(v for _, v in pools) sum v v for _, v in pools for _, v in pools _ v pools for _, v in pools v print(len(pools), *(v for _, v in pools)) print len(pools) len pools *(v for _, v in pools) (v for _, v in pools) height -= 1 1 height height += 1 1 height cross_section = input() input() cross_section _, volume = pools.pop() pools.pop() _ sm += volume volume sm height = 0 0 height width = i - visited[height] i - visited[height] width sm = 0 0 sm visited = {0: -1} {0: -1} visited pools = [] [] pools volume = pools.pop() pools.pop() volume
cross_section = input()
visited = {0: -1}
height = 0
pools = []
for i, c in enumerate(cross_section):
    if c == '\\':
        height -= 1
    elif c == '/':
        height += 1
        if height in visited:
            width = i - visited[height]
            sm = 0
            while pools and pools[-1][0] > visited[height]:
                _, volume = pools.pop()
                sm += volume
            pools.append((i, sm + width - 1))
    visited[height] = i

print(sum(v for _, v in pools))
print(len(pools), *(v for _, v in pools))