"""
O(n^2)??????????§£???
"""

danmen = input()
depth = []
tmp_dpt = 0

for line in danmen:
    depth.append(tmp_dpt)

    if line == "\\":
        tmp_dpt -= 1
    elif line == "/":
        tmp_dpt += 1

# len(depth) = len(danmen) + 1?????¨???
depth.append(tmp_dpt)

# print(depth)

i = 0
L = []

while i < len(danmen):
    if len(set(danmen[i:])) == 1:
        break

    if danmen[i] == "\\":
        if depth[i] in depth[i + 1:]:
            stack = 0
            area = 0

            for line in danmen[i:]:
                if line == "\\":
                    area += 1 + 2 * stack
                    stack += 1
                elif line == "/":
                    stack -= 1
                    area += 1 + 2 * stack
                else:
                    area += 2 * stack

                if stack == 0:
                    break

            if area != 0:
                L.append(area // 2)
                i += depth[i + 1:].index(depth[i])

    i += 1

print(sum(L))
print(len(L), *L) """
O(n^2)??????????§£???
""" danmen = input() danmen input() input depth = [] depth [] tmp_dpt = 0 tmp_dpt 0 for line in danmen:
    depth.append(tmp_dpt)

    if line == "\\":
        tmp_dpt -= 1
    elif line == "/":
        tmp_dpt += 1

# len(depth) = len(danmen) + 1?????¨??? line danmen depth.append(tmp_dpt) depth.append depth append tmp_dpt if line == "\\":
        tmp_dpt -= 1
    elif line == "/":
        tmp_dpt += 1

# len(depth) = len(danmen) + 1?????¨??? line == "\\" line "\\" tmp_dpt -= 1 tmp_dpt 1 elif line == "/":
        tmp_dpt += 1

# len(depth) = len(danmen) + 1?????¨??? line == "/" line "/" tmp_dpt += 1 tmp_dpt 1 depth.append(tmp_dpt) depth.append depth append tmp_dpt i = 0 i 0 L = [] L [] while i < len(danmen):
    if len(set(danmen[i:])) == 1:
        break

    if danmen[i] == "\\":
        if depth[i] in depth[i + 1:]:
            stack = 0
            area = 0

            for line in danmen[i:]:
                if line == "\\":
                    area += 1 + 2 * stack
                    stack += 1
                elif line == "/":
                    stack -= 1
                    area += 1 + 2 * stack
                else:
                    area += 2 * stack

                if stack == 0:
                    break

            if area != 0:
                L.append(area // 2)
                i += depth[i + 1:].index(depth[i])

    i += 1 i < len(danmen) i len(danmen) len danmen if len(set(danmen[i:])) == 1:
        break

     len(set(danmen[i:])) == 1 len(set(danmen[i:])) len set(danmen[i:]) set danmen[i:] danmen i: i 1 break if danmen[i] == "\\":
        if depth[i] in depth[i + 1:]:
            stack = 0
            area = 0

            for line in danmen[i:]:
                if line == "\\":
                    area += 1 + 2 * stack
                    stack += 1
                elif line == "/":
                    stack -= 1
                    area += 1 + 2 * stack
                else:
                    area += 2 * stack

                if stack == 0:
                    break

            if area != 0:
                L.append(area // 2)
                i += depth[i + 1:].index(depth[i])

     danmen[i] == "\\" danmen[i] danmen i "\\" if depth[i] in depth[i + 1:]:
            stack = 0
            area = 0

            for line in danmen[i:]:
                if line == "\\":
                    area += 1 + 2 * stack
                    stack += 1
                elif line == "/":
                    stack -= 1
                    area += 1 + 2 * stack
                else:
                    area += 2 * stack

                if stack == 0:
                    break

            if area != 0:
                L.append(area // 2)
                i += depth[i + 1:].index(depth[i])

     depth[i] in depth[i + 1:] depth[i] depth i depth[i + 1:] depth i + 1: i + 1 i 1 stack = 0 stack 0 area = 0 area 0 for line in danmen[i:]:
                if line == "\\":
                    area += 1 + 2 * stack
                    stack += 1
                elif line == "/":
                    stack -= 1
                    area += 1 + 2 * stack
                else:
                    area += 2 * stack

                if stack == 0:
                    break

             line danmen[i:] danmen i: i if line == "\\":
                    area += 1 + 2 * stack
                    stack += 1
                elif line == "/":
                    stack -= 1
                    area += 1 + 2 * stack
                else:
                    area += 2 * stack

                 line == "\\" line "\\" area += 1 + 2 * stack area 1 + 2 * stack 1 2 * stack 2 stack stack += 1 stack 1 elif line == "/":
                    stack -= 1
                    area += 1 + 2 * stack
                 line == "/" line "/" stack -= 1 stack 1 area += 1 + 2 * stack area 1 + 2 * stack 1 2 * stack 2 stack area += 2 * stack area 2 * stack 2 stack if stack == 0:
                    break

             stack == 0 stack 0 break if area != 0:
                L.append(area // 2)
                i += depth[i + 1:].index(depth[i])

     area != 0 area 0 L.append(area // 2) L.append L append area // 2 area 2 i += depth[i + 1:].index(depth[i]) i depth[i + 1:].index(depth[i]) [i + 1:].index [i + 1:] depth i + 1: i + 1 i 1 index depth[i] depth i i += 1 i 1 print(sum(L)) print sum(L) sum L print(len(L), *L) print len(L) len L *L L i += depth[i + 1:].index(depth[i]) depth[i + 1:].index(depth[i]) i stack = 0 0 stack tmp_dpt += 1 1 tmp_dpt stack -= 1 1 stack L = [] [] L area = 0 0 area i += 1 1 i tmp_dpt = 0 0 tmp_dpt i = 0 0 i area += 1 + 2 * stack 1 + 2 * stack area area += 2 * stack 2 * stack area depth = [] [] depth stack += 1 1 stack tmp_dpt -= 1 1 tmp_dpt area += 1 + 2 * stack 1 + 2 * stack area danmen = input() input() danmen
"""
O(n^2)??????????§£???
"""

danmen = input()
depth = []
tmp_dpt = 0

for line in danmen:
    depth.append(tmp_dpt)

    if line == "\\":
        tmp_dpt -= 1
    elif line == "/":
        tmp_dpt += 1

# len(depth) = len(danmen) + 1?????¨???
depth.append(tmp_dpt)

# print(depth)

i = 0
L = []

while i < len(danmen):
    if len(set(danmen[i:])) == 1:
        break

    if danmen[i] == "\\":
        if depth[i] in depth[i + 1:]:
            stack = 0
            area = 0

            for line in danmen[i:]:
                if line == "\\":
                    area += 1 + 2 * stack
                    stack += 1
                elif line == "/":
                    stack -= 1
                    area += 1 + 2 * stack
                else:
                    area += 2 * stack

                if stack == 0:
                    break

            if area != 0:
                L.append(area // 2)
                i += depth[i + 1:].index(depth[i])

    i += 1

print(sum(L))
print(len(L), *L)