from collections import deque
def calculate_area(lines):
    q = deque()
    partial_area = 0
    areas = []
    total_area = 0
    for i, line in enumerate(lines):
        if line == "\\":
            q.append(i)
        elif line == "/":
            if q:
                num = q.pop()
                partial_area = i - num
                total_area += partial_area
                for p_area in areas[::-1]:
                    if p_area[0] > num:
                        partial_area += areas.pop()[1]
                    else:
                        break
                areas.append([num, partial_area])
    areas_strigified = [str(v) for i, v in areas]
    print(total_area)
    if total_area:
        print("{} {}".format(len(areas), ' '.join(areas_strigified)))
    else:
        print(0)
                    

if __name__ == "__main__":
    data = input()
    calculate_area(data) from collections import deque def calculate_area(lines):
    q = deque()
    partial_area = 0
    areas = []
    total_area = 0
    for i, line in enumerate(lines):
        if line == "\\":
            q.append(i)
        elif line == "/":
            if q:
                num = q.pop()
                partial_area = i - num
                total_area += partial_area
                for p_area in areas[::-1]:
                    if p_area[0] > num:
                        partial_area += areas.pop()[1]
                    else:
                        break
                areas.append([num, partial_area])
    areas_strigified = [str(v) for i, v in areas]
    print(total_area)
    if total_area:
        print("{} {}".format(len(areas), ' '.join(areas_strigified)))
    else:
        print(0)
                     calculate_area q = deque() q deque() deque partial_area = 0 partial_area 0 areas = [] areas [] total_area = 0 total_area 0 for i, line in enumerate(lines):
        if line == "\\":
            q.append(i)
        elif line == "/":
            if q:
                num = q.pop()
                partial_area = i - num
                total_area += partial_area
                for p_area in areas[::-1]:
                    if p_area[0] > num:
                        partial_area += areas.pop()[1]
                    else:
                        break
                areas.append([num, partial_area])
     i line enumerate(lines) enumerate lines if line == "\\":
            q.append(i)
        elif line == "/":
            if q:
                num = q.pop()
                partial_area = i - num
                total_area += partial_area
                for p_area in areas[::-1]:
                    if p_area[0] > num:
                        partial_area += areas.pop()[1]
                    else:
                        break
                areas.append([num, partial_area])
     line == "\\" line "\\" q.append(i) q.append q append i elif line == "/":
            if q:
                num = q.pop()
                partial_area = i - num
                total_area += partial_area
                for p_area in areas[::-1]:
                    if p_area[0] > num:
                        partial_area += areas.pop()[1]
                    else:
                        break
                areas.append([num, partial_area])
     line == "/" line "/" if q:
                num = q.pop()
                partial_area = i - num
                total_area += partial_area
                for p_area in areas[::-1]:
                    if p_area[0] > num:
                        partial_area += areas.pop()[1]
                    else:
                        break
                areas.append([num, partial_area])
     q num = q.pop() num q.pop() q.pop q pop partial_area = i - num partial_area i - num i num total_area += partial_area total_area partial_area for p_area in areas[::-1]:
                    if p_area[0] > num:
                        partial_area += areas.pop()[1]
                    else:
                        break
                 p_area areas[::-1] areas ::-1 -1 if p_area[0] > num:
                        partial_area += areas.pop()[1]
                    else:
                        break
                 p_area[0] > num p_area[0] p_area 0 num partial_area += areas.pop()[1] partial_area areas.pop()[1] areas.pop() areas.pop areas pop 1 break areas.append([num, partial_area]) areas.append areas append [num, partial_area] num partial_area str(v) for i, v in areas for i, v in areas i v areas for i, v in areas str(v) str v areas_strigified = [str(v) for i, v in areas] areas_strigified [str(v) for i, v in areas] print(total_area) print total_area if total_area:
        print("{} {}".format(len(areas), ' '.join(areas_strigified)))
    else:
        print(0)
                     total_area print("{} {}".format(len(areas), ' '.join(areas_strigified))) print "{} {}".format(len(areas), ' '.join(areas_strigified)) "{} {}".format "{} {}" format len(areas) len areas ' '.join(areas_strigified) ' '.join ' ' join areas_strigified print(0) print 0 lines lines if __name__ == "__main__":
    data = input()
    calculate_area(data) __name__ == "__main__" __name__ "__main__" data = input() data input() input calculate_area(data) calculate_area data def calculate_area(lines):
    q = deque()
    partial_area = 0
    areas = []
    total_area = 0
    for i, line in enumerate(lines):
        if line == "\\":
            q.append(i)
        elif line == "/":
            if q:
                num = q.pop()
                partial_area = i - num
                total_area += partial_area
                for p_area in areas[::-1]:
                    if p_area[0] > num:
                        partial_area += areas.pop()[1]
                    else:
                        break
                areas.append([num, partial_area])
    areas_strigified = [str(v) for i, v in areas]
    print(total_area)
    if total_area:
        print("{} {}".format(len(areas), ' '.join(areas_strigified)))
    else:
        print(0)
                     def calculate_area(lines):
    q = deque()
    partial_area = 0
    areas = []
    total_area = 0
    for i, line in enumerate(lines):
        if line == "\\":
            q.append(i)
        elif line == "/":
            if q:
                num = q.pop()
                partial_area = i - num
                total_area += partial_area
                for p_area in areas[::-1]:
                    if p_area[0] > num:
                        partial_area += areas.pop()[1]
                    else:
                        break
                areas.append([num, partial_area])
    areas_strigified = [str(v) for i, v in areas]
    print(total_area)
    if total_area:
        print("{} {}".format(len(areas), ' '.join(areas_strigified)))
    else:
        print(0)
                     calculate_area data = input() input() data
from collections import deque
def calculate_area(lines):
    q = deque()
    partial_area = 0
    areas = []
    total_area = 0
    for i, line in enumerate(lines):
        if line == "\\":
            q.append(i)
        elif line == "/":
            if q:
                num = q.pop()
                partial_area = i - num
                total_area += partial_area
                for p_area in areas[::-1]:
                    if p_area[0] > num:
                        partial_area += areas.pop()[1]
                    else:
                        break
                areas.append([num, partial_area])
    areas_strigified = [str(v) for i, v in areas]
    print(total_area)
    if total_area:
        print("{} {}".format(len(areas), ' '.join(areas_strigified)))
    else:
        print(0)
                    

if __name__ == "__main__":
    data = input()
    calculate_area(data)
