downhill_stack = []
idx_area_stack = []
for idx, c in enumerate(input()):
    if c == '\\':
        downhill_stack.append(idx)
    elif c == '/' and len(downhill_stack) > 0:
        downhill_idx = downhill_stack.pop()
        current_level_area = idx - downhill_idx
        if len(idx_area_stack) == 0:
            idx_area_stack.append((downhill_idx, current_level_area))
            continue
        last_idx = idx_area_stack[-1][0]
        if downhill_idx < last_idx:
            prov_area = current_level_area
            while downhill_idx < last_idx:
                idx_area = idx_area_stack.pop()
                prov_area += idx_area[1]
                if len(idx_area_stack) == 0:
                    break
                last_idx = idx_area_stack[-1][0]
            prov_idx_area = (downhill_idx, prov_area)
            idx_area_stack.append(prov_idx_area)
        else:
            idx_area_stack.append((downhill_idx, current_level_area))
puddle_num = len(idx_area_stack)
areas = list(map(lambda x: x[1], idx_area_stack))
print(sum(areas))
if puddle_num > 0:
    print(puddle_num, " ".join(map(str, areas)))
else:
    print(puddle_num) downhill_stack = [] downhill_stack [] idx_area_stack = [] idx_area_stack [] for idx, c in enumerate(input()):
    if c == '\\':
        downhill_stack.append(idx)
    elif c == '/' and len(downhill_stack) > 0:
        downhill_idx = downhill_stack.pop()
        current_level_area = idx - downhill_idx
        if len(idx_area_stack) == 0:
            idx_area_stack.append((downhill_idx, current_level_area))
            continue
        last_idx = idx_area_stack[-1][0]
        if downhill_idx < last_idx:
            prov_area = current_level_area
            while downhill_idx < last_idx:
                idx_area = idx_area_stack.pop()
                prov_area += idx_area[1]
                if len(idx_area_stack) == 0:
                    break
                last_idx = idx_area_stack[-1][0]
            prov_idx_area = (downhill_idx, prov_area)
            idx_area_stack.append(prov_idx_area)
        else:
            idx_area_stack.append((downhill_idx, current_level_area)) idx c enumerate(input()) enumerate input() input if c == '\\':
        downhill_stack.append(idx)
    elif c == '/' and len(downhill_stack) > 0:
        downhill_idx = downhill_stack.pop()
        current_level_area = idx - downhill_idx
        if len(idx_area_stack) == 0:
            idx_area_stack.append((downhill_idx, current_level_area))
            continue
        last_idx = idx_area_stack[-1][0]
        if downhill_idx < last_idx:
            prov_area = current_level_area
            while downhill_idx < last_idx:
                idx_area = idx_area_stack.pop()
                prov_area += idx_area[1]
                if len(idx_area_stack) == 0:
                    break
                last_idx = idx_area_stack[-1][0]
            prov_idx_area = (downhill_idx, prov_area)
            idx_area_stack.append(prov_idx_area)
        else:
            idx_area_stack.append((downhill_idx, current_level_area)) c == '\\' c '\\' downhill_stack.append(idx) downhill_stack.append downhill_stack append idx elif c == '/' and len(downhill_stack) > 0:
        downhill_idx = downhill_stack.pop()
        current_level_area = idx - downhill_idx
        if len(idx_area_stack) == 0:
            idx_area_stack.append((downhill_idx, current_level_area))
            continue
        last_idx = idx_area_stack[-1][0]
        if downhill_idx < last_idx:
            prov_area = current_level_area
            while downhill_idx < last_idx:
                idx_area = idx_area_stack.pop()
                prov_area += idx_area[1]
                if len(idx_area_stack) == 0:
                    break
                last_idx = idx_area_stack[-1][0]
            prov_idx_area = (downhill_idx, prov_area)
            idx_area_stack.append(prov_idx_area)
        else:
            idx_area_stack.append((downhill_idx, current_level_area)) c == '/' and len(downhill_stack) > 0 c == '/' c '/' len(downhill_stack) > 0 len(downhill_stack) len downhill_stack 0 downhill_idx = downhill_stack.pop() downhill_idx downhill_stack.pop() downhill_stack.pop downhill_stack pop current_level_area = idx - downhill_idx current_level_area idx - downhill_idx idx downhill_idx if len(idx_area_stack) == 0:
            idx_area_stack.append((downhill_idx, current_level_area))
            continue
         len(idx_area_stack) == 0 len(idx_area_stack) len idx_area_stack 0 idx_area_stack.append((downhill_idx, current_level_area)) idx_area_stack.append idx_area_stack append (downhill_idx, current_level_area) downhill_idx current_level_area continue last_idx = idx_area_stack[-1][0] last_idx idx_area_stack[-1][0] [-1] idx_area_stack -1 0 if downhill_idx < last_idx:
            prov_area = current_level_area
            while downhill_idx < last_idx:
                idx_area = idx_area_stack.pop()
                prov_area += idx_area[1]
                if len(idx_area_stack) == 0:
                    break
                last_idx = idx_area_stack[-1][0]
            prov_idx_area = (downhill_idx, prov_area)
            idx_area_stack.append(prov_idx_area)
        else:
            idx_area_stack.append((downhill_idx, current_level_area)) downhill_idx < last_idx downhill_idx last_idx prov_area = current_level_area prov_area current_level_area while downhill_idx < last_idx:
                idx_area = idx_area_stack.pop()
                prov_area += idx_area[1]
                if len(idx_area_stack) == 0:
                    break
                last_idx = idx_area_stack[-1][0]
             downhill_idx < last_idx downhill_idx last_idx idx_area = idx_area_stack.pop() idx_area idx_area_stack.pop() idx_area_stack.pop idx_area_stack pop prov_area += idx_area[1] prov_area idx_area[1] idx_area 1 if len(idx_area_stack) == 0:
                    break
                 len(idx_area_stack) == 0 len(idx_area_stack) len idx_area_stack 0 break last_idx = idx_area_stack[-1][0] last_idx idx_area_stack[-1][0] [-1] idx_area_stack -1 0 prov_idx_area = (downhill_idx, prov_area) prov_idx_area (downhill_idx, prov_area) downhill_idx prov_area idx_area_stack.append(prov_idx_area) idx_area_stack.append idx_area_stack append prov_idx_area idx_area_stack.append((downhill_idx, current_level_area)) idx_area_stack.append idx_area_stack append (downhill_idx, current_level_area) downhill_idx current_level_area puddle_num = len(idx_area_stack) puddle_num len(idx_area_stack) len idx_area_stack areas = list(map(lambda x: x[1], idx_area_stack)) areas list(map(lambda x: x[1], idx_area_stack)) list map(lambda x: x[1], idx_area_stack) map lambda x: x[1] x[1] x 1 x idx_area_stack print(sum(areas)) print sum(areas) sum areas if puddle_num > 0:
    print(puddle_num, " ".join(map(str, areas)))
else:
    print(puddle_num) puddle_num > 0 puddle_num 0 print(puddle_num, " ".join(map(str, areas))) print puddle_num " ".join(map(str, areas)) " ".join " " join map(str, areas) map str areas print(puddle_num) print puddle_num prov_area = current_level_area current_level_area prov_area puddle_num = len(idx_area_stack) len(idx_area_stack) puddle_num current_level_area = idx - downhill_idx idx - downhill_idx current_level_area idx_area = idx_area_stack.pop() idx_area_stack.pop() idx_area prov_area += idx_area[1] idx_area[1] prov_area downhill_stack = [] [] downhill_stack prov_idx_area = (downhill_idx, prov_area) (downhill_idx, prov_area) prov_idx_area idx_area_stack = [] [] idx_area_stack last_idx = idx_area_stack[-1][0] idx_area_stack[-1][0] last_idx downhill_idx = downhill_stack.pop() downhill_stack.pop() downhill_idx last_idx = idx_area_stack[-1][0] idx_area_stack[-1][0] last_idx areas = list(map(lambda x: x[1], idx_area_stack)) list(map(lambda x: x[1], idx_area_stack)) areas
downhill_stack = []
idx_area_stack = []
for idx, c in enumerate(input()):
    if c == '\\':
        downhill_stack.append(idx)
    elif c == '/' and len(downhill_stack) > 0:
        downhill_idx = downhill_stack.pop()
        current_level_area = idx - downhill_idx
        if len(idx_area_stack) == 0:
            idx_area_stack.append((downhill_idx, current_level_area))
            continue
        last_idx = idx_area_stack[-1][0]
        if downhill_idx < last_idx:
            prov_area = current_level_area
            while downhill_idx < last_idx:
                idx_area = idx_area_stack.pop()
                prov_area += idx_area[1]
                if len(idx_area_stack) == 0:
                    break
                last_idx = idx_area_stack[-1][0]
            prov_idx_area = (downhill_idx, prov_area)
            idx_area_stack.append(prov_idx_area)
        else:
            idx_area_stack.append((downhill_idx, current_level_area))
puddle_num = len(idx_area_stack)
areas = list(map(lambda x: x[1], idx_area_stack))
print(sum(areas))
if puddle_num > 0:
    print(puddle_num, " ".join(map(str, areas)))
else:
    print(puddle_num)
