from sys import stdin
def stdinput():
    return stdin.readline().strip()

def main():
    altitutes = load_data()

    edges = create_edges(altitutes)

    # print(*edges)

    areas = calc_areas(altitutes, edges)

    print(int(sum(areas)))
    print(*([len(areas)] + [*map(int, areas)]))

def load_data():
    A = [0]
    for s in stdinput():
        if s == '\\':
            A.append(A[-1] - 1)
        elif s == '_':
            A.append(A[-1])
        elif s == '/':
            A.append(A[-1] + 1) 
    return A

def create_edges(A):
    st = [(0, None, 0)]
    highest = 0
    for i, a in enumerate(A[1:], 1):
        if st[-1][0] >= a:
            st.append((a, st[-1][2], i))
        else:
            begin = i - 1
            # NOTE: concat edges
            # this operation is performed every upforward(/) step,
            # and previous concated edges have altitute of (a - 1).
            while st[-1][1] != None and st[-1][0] == a - 1 and highest >= a:
                lev, begin, j = st.pop()
            highest = max(highest, a)
            st.append((a, begin, i))
        # print(*st)
    return [*map(lambda e: e[1:], st[1:])]

def calc_areas(A, edges):
    areas = []
    for begin, end in edges:
        area = calc_area(A, begin, end)
        if area > 0:
            areas.append(area)
    return areas    

def calc_area(A, begin, end):
    if A[begin] != A[end]:
        return 0
    b_level = A[begin]
    area = 0
    for l1, l2 in zip(range(begin, end), range(begin+1, end + 1)):
        a1 = A[l1]
        a2 = A[l2]
        area += (b_level - a1 + b_level - a2) * 1 / 2
    return area

if __name__ == '__main__':
    main()
    # import cProfile
    # cProfile.run('main()') from sys import stdin def stdinput():
    return stdin.readline().strip() stdinput return stdin.readline().strip() stdin.readline().strip() stdin.readline().strip stdin.readline() stdin.readline stdin readline strip def main():
    altitutes = load_data()

    edges = create_edges(altitutes)

    # print(*edges)

    areas = calc_areas(altitutes, edges)

    print(int(sum(areas)))
    print(*([len(areas)] + [*map(int, areas)])) main altitutes = load_data() altitutes load_data() load_data edges = create_edges(altitutes) edges create_edges(altitutes) create_edges altitutes areas = calc_areas(altitutes, edges) areas calc_areas(altitutes, edges) calc_areas altitutes edges print(int(sum(areas))) print int(sum(areas)) int sum(areas) sum areas print(*([len(areas)] + [*map(int, areas)])) print *([len(areas)] + [*map(int, areas)]) [len(areas)] + [*map(int, areas)] [len(areas)] len(areas) len areas [*map(int, areas)] *map(int, areas) map(int, areas) map int areas def load_data():
    A = [0]
    for s in stdinput():
        if s == '\\':
            A.append(A[-1] - 1)
        elif s == '_':
            A.append(A[-1])
        elif s == '/':
            A.append(A[-1] + 1) 
    return A load_data A = [0] A [0] 0 for s in stdinput():
        if s == '\\':
            A.append(A[-1] - 1)
        elif s == '_':
            A.append(A[-1])
        elif s == '/':
            A.append(A[-1] + 1) 
     s stdinput() stdinput if s == '\\':
            A.append(A[-1] - 1)
        elif s == '_':
            A.append(A[-1])
        elif s == '/':
            A.append(A[-1] + 1) 
     s == '\\' s '\\' A.append(A[-1] - 1) A.append A append A[-1] - 1 A[-1] A -1 1 elif s == '_':
            A.append(A[-1])
         s == '_' s '_' A.append(A[-1]) A.append A append A[-1] A -1 elif s == '/':
            A.append(A[-1] + 1) 
     s == '/' s '/' A.append(A[-1] + 1) A.append A append A[-1] + 1 A[-1] A -1 1 return A A def create_edges(A):
    st = [(0, None, 0)]
    highest = 0
    for i, a in enumerate(A[1:], 1):
        if st[-1][0] >= a:
            st.append((a, st[-1][2], i))
        else:
            begin = i - 1
            # NOTE: concat edges
            # this operation is performed every upforward(/) step,
            # and previous concated edges have altitute of (a - 1).
            while st[-1][1] != None and st[-1][0] == a - 1 and highest >= a:
                lev, begin, j = st.pop()
            highest = max(highest, a)
            st.append((a, begin, i))
        # print(*st)
    return [*map(lambda e: e[1:], st[1:])] create_edges st = [(0, None, 0)] st [(0, None, 0)] (0, None, 0) 0 None 0 highest = 0 highest 0 for i, a in enumerate(A[1:], 1):
        if st[-1][0] >= a:
            st.append((a, st[-1][2], i))
        else:
            begin = i - 1
            # NOTE: concat edges
            # this operation is performed every upforward(/) step,
            # and previous concated edges have altitute of (a - 1).
            while st[-1][1] != None and st[-1][0] == a - 1 and highest >= a:
                lev, begin, j = st.pop()
            highest = max(highest, a)
            st.append((a, begin, i))
        # print(*st)
     i a enumerate(A[1:], 1) enumerate A[1:] A 1: 1 1 if st[-1][0] >= a:
            st.append((a, st[-1][2], i))
        else:
            begin = i - 1
            # NOTE: concat edges
            # this operation is performed every upforward(/) step,
            # and previous concated edges have altitute of (a - 1).
            while st[-1][1] != None and st[-1][0] == a - 1 and highest >= a:
                lev, begin, j = st.pop()
            highest = max(highest, a)
            st.append((a, begin, i))
        # print(*st)
     st[-1][0] >= a st[-1][0] [-1] st -1 0 a st.append((a, st[-1][2], i)) st.append st append (a, st[-1][2], i) a st[-1][2] [-1] st -1 2 i begin = i - 1 begin i - 1 i 1 while st[-1][1] != None and st[-1][0] == a - 1 and highest >= a:
                lev, begin, j = st.pop()
             st[-1][1] != None and st[-1][0] == a - 1 and highest >= a st[-1][1] != None and st[-1][0] == a - 1 st[-1][1] != None st[-1][1] [-1] st -1 1 None st[-1][0] == a - 1 st[-1][0] [-1] st -1 0 a - 1 a 1 highest >= a highest a lev, begin, j = st.pop() lev st.pop() st.pop st pop begin j highest = max(highest, a) highest max(highest, a) max highest a st.append((a, begin, i)) st.append st append (a, begin, i) a begin i return [*map(lambda e: e[1:], st[1:])] [*map(lambda e: e[1:], st[1:])] *map(lambda e: e[1:], st[1:]) map(lambda e: e[1:], st[1:]) map lambda e: e[1:] e[1:] e 1: 1 e st[1:] st 1: 1 A A def calc_areas(A, edges):
    areas = []
    for begin, end in edges:
        area = calc_area(A, begin, end)
        if area > 0:
            areas.append(area)
    return areas     calc_areas areas = [] areas [] for begin, end in edges:
        area = calc_area(A, begin, end)
        if area > 0:
            areas.append(area)
     begin end edges area = calc_area(A, begin, end) area calc_area(A, begin, end) calc_area A begin end if area > 0:
            areas.append(area)
     area > 0 area 0 areas.append(area) areas.append areas append area return areas areas A A edges edges def calc_area(A, begin, end):
    if A[begin] != A[end]:
        return 0
    b_level = A[begin]
    area = 0
    for l1, l2 in zip(range(begin, end), range(begin+1, end + 1)):
        a1 = A[l1]
        a2 = A[l2]
        area += (b_level - a1 + b_level - a2) * 1 / 2
    return area calc_area if A[begin] != A[end]:
        return 0
     A[begin] != A[end] A[begin] A begin A[end] A end return 0 0 b_level = A[begin] b_level A[begin] A begin area = 0 area 0 for l1, l2 in zip(range(begin, end), range(begin+1, end + 1)):
        a1 = A[l1]
        a2 = A[l2]
        area += (b_level - a1 + b_level - a2) * 1 / 2
     l1 l2 zip(range(begin, end), range(begin+1, end + 1)) zip range(begin, end) range begin end range(begin+1, end + 1) range begin+1 begin 1 end + 1 end 1 a1 = A[l1] a1 A[l1] A l1 a2 = A[l2] a2 A[l2] A l2 area += (b_level - a1 + b_level - a2) * 1 / 2 area (b_level - a1 + b_level - a2) * 1 / 2 (b_level - a1 + b_level - a2) * 1 b_level - a1 + b_level - a2 b_level - a1 + b_level b_level - a1 b_level a1 b_level a2 1 2 return area area A A begin begin end end if __name__ == '__main__':
    main()
    # import cProfile
    # cProfile.run('main()') __name__ == '__main__' __name__ '__main__' main() main def main():
    altitutes = load_data()

    edges = create_edges(altitutes)

    # print(*edges)

    areas = calc_areas(altitutes, edges)

    print(int(sum(areas)))
    print(*([len(areas)] + [*map(int, areas)])) def main():
    altitutes = load_data()

    edges = create_edges(altitutes)

    # print(*edges)

    areas = calc_areas(altitutes, edges)

    print(int(sum(areas)))
    print(*([len(areas)] + [*map(int, areas)])) main def create_edges(A):
    st = [(0, None, 0)]
    highest = 0
    for i, a in enumerate(A[1:], 1):
        if st[-1][0] >= a:
            st.append((a, st[-1][2], i))
        else:
            begin = i - 1
            # NOTE: concat edges
            # this operation is performed every upforward(/) step,
            # and previous concated edges have altitute of (a - 1).
            while st[-1][1] != None and st[-1][0] == a - 1 and highest >= a:
                lev, begin, j = st.pop()
            highest = max(highest, a)
            st.append((a, begin, i))
        # print(*st)
    return [*map(lambda e: e[1:], st[1:])] def create_edges(A):
    st = [(0, None, 0)]
    highest = 0
    for i, a in enumerate(A[1:], 1):
        if st[-1][0] >= a:
            st.append((a, st[-1][2], i))
        else:
            begin = i - 1
            # NOTE: concat edges
            # this operation is performed every upforward(/) step,
            # and previous concated edges have altitute of (a - 1).
            while st[-1][1] != None and st[-1][0] == a - 1 and highest >= a:
                lev, begin, j = st.pop()
            highest = max(highest, a)
            st.append((a, begin, i))
        # print(*st)
    return [*map(lambda e: e[1:], st[1:])] create_edges def load_data():
    A = [0]
    for s in stdinput():
        if s == '\\':
            A.append(A[-1] - 1)
        elif s == '_':
            A.append(A[-1])
        elif s == '/':
            A.append(A[-1] + 1) 
    return A def load_data():
    A = [0]
    for s in stdinput():
        if s == '\\':
            A.append(A[-1] - 1)
        elif s == '_':
            A.append(A[-1])
        elif s == '/':
            A.append(A[-1] + 1) 
    return A load_data def calc_area(A, begin, end):
    if A[begin] != A[end]:
        return 0
    b_level = A[begin]
    area = 0
    for l1, l2 in zip(range(begin, end), range(begin+1, end + 1)):
        a1 = A[l1]
        a2 = A[l2]
        area += (b_level - a1 + b_level - a2) * 1 / 2
    return area def calc_area(A, begin, end):
    if A[begin] != A[end]:
        return 0
    b_level = A[begin]
    area = 0
    for l1, l2 in zip(range(begin, end), range(begin+1, end + 1)):
        a1 = A[l1]
        a2 = A[l2]
        area += (b_level - a1 + b_level - a2) * 1 / 2
    return area calc_area def calc_areas(A, edges):
    areas = []
    for begin, end in edges:
        area = calc_area(A, begin, end)
        if area > 0:
            areas.append(area)
    return areas     def calc_areas(A, edges):
    areas = []
    for begin, end in edges:
        area = calc_area(A, begin, end)
        if area > 0:
            areas.append(area)
    return areas     calc_areas def stdinput():
    return stdin.readline().strip() def stdinput():
    return stdin.readline().strip() stdinput
from sys import stdin
def stdinput():
    return stdin.readline().strip()

def main():
    altitutes = load_data()

    edges = create_edges(altitutes)

    # print(*edges)

    areas = calc_areas(altitutes, edges)

    print(int(sum(areas)))
    print(*([len(areas)] + [*map(int, areas)]))

def load_data():
    A = [0]
    for s in stdinput():
        if s == '\\':
            A.append(A[-1] - 1)
        elif s == '_':
            A.append(A[-1])
        elif s == '/':
            A.append(A[-1] + 1) 
    return A

def create_edges(A):
    st = [(0, None, 0)]
    highest = 0
    for i, a in enumerate(A[1:], 1):
        if st[-1][0] >= a:
            st.append((a, st[-1][2], i))
        else:
            begin = i - 1
            # NOTE: concat edges
            # this operation is performed every upforward(/) step,
            # and previous concated edges have altitute of (a - 1).
            while st[-1][1] != None and st[-1][0] == a - 1 and highest >= a:
                lev, begin, j = st.pop()
            highest = max(highest, a)
            st.append((a, begin, i))
        # print(*st)
    return [*map(lambda e: e[1:], st[1:])]

def calc_areas(A, edges):
    areas = []
    for begin, end in edges:
        area = calc_area(A, begin, end)
        if area > 0:
            areas.append(area)
    return areas    

def calc_area(A, begin, end):
    if A[begin] != A[end]:
        return 0
    b_level = A[begin]
    area = 0
    for l1, l2 in zip(range(begin, end), range(begin+1, end + 1)):
        a1 = A[l1]
        a2 = A[l2]
        area += (b_level - a1 + b_level - a2) * 1 / 2
    return area

if __name__ == '__main__':
    main()
    # import cProfile
    # cProfile.run('main()')
