def main():
    from collections import deque
    from operator import itemgetter

    s = input()

    tot = 0
    areas = []

    dq = deque()
    for i, c in enumerate(s):
        # print(c, end='')

        if c == '\\':
            dq.append(i)
        elif c == '/':
            if dq:
                j = dq.pop()
                a = i - j
                tot += a

                while areas and areas[-1][0] > j:
                    a += areas.pop()[1]
                areas.append((i, a))

    print(tot)
    print(len(areas), *map(itemgetter(1), areas))


if __name__ == '__main__':
    main()
 def main():
    from collections import deque
    from operator import itemgetter

    s = input()

    tot = 0
    areas = []

    dq = deque()
    for i, c in enumerate(s):
        # print(c, end='')

        if c == '\\':
            dq.append(i)
        elif c == '/':
            if dq:
                j = dq.pop()
                a = i - j
                tot += a

                while areas and areas[-1][0] > j:
                    a += areas.pop()[1]
                areas.append((i, a))

    print(tot)
    print(len(areas), *map(itemgetter(1), areas)) main from collections import deque from operator import itemgetter s = input() s input() input tot = 0 tot 0 areas = [] areas [] dq = deque() dq deque() deque for i, c in enumerate(s):
        # print(c, end='')

        if c == '\\':
            dq.append(i)
        elif c == '/':
            if dq:
                j = dq.pop()
                a = i - j
                tot += a

                while areas and areas[-1][0] > j:
                    a += areas.pop()[1]
                areas.append((i, a))

     i c enumerate(s) enumerate s if c == '\\':
            dq.append(i)
        elif c == '/':
            if dq:
                j = dq.pop()
                a = i - j
                tot += a

                while areas and areas[-1][0] > j:
                    a += areas.pop()[1]
                areas.append((i, a))

     c == '\\' c '\\' dq.append(i) dq.append dq append i elif c == '/':
            if dq:
                j = dq.pop()
                a = i - j
                tot += a

                while areas and areas[-1][0] > j:
                    a += areas.pop()[1]
                areas.append((i, a))

     c == '/' c '/' if dq:
                j = dq.pop()
                a = i - j
                tot += a

                while areas and areas[-1][0] > j:
                    a += areas.pop()[1]
                areas.append((i, a))

     dq j = dq.pop() j dq.pop() dq.pop dq pop a = i - j a i - j i j tot += a tot a while areas and areas[-1][0] > j:
                    a += areas.pop()[1]
                 areas and areas[-1][0] > j areas areas[-1][0] > j areas[-1][0] [-1] areas -1 0 j a += areas.pop()[1] a areas.pop()[1] areas.pop() areas.pop areas pop 1 areas.append((i, a)) areas.append areas append (i, a) i a print(tot) print tot print(len(areas), *map(itemgetter(1), areas)) print len(areas) len areas *map(itemgetter(1), areas) map(itemgetter(1), areas) map itemgetter(1) itemgetter 1 areas if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    from collections import deque
    from operator import itemgetter

    s = input()

    tot = 0
    areas = []

    dq = deque()
    for i, c in enumerate(s):
        # print(c, end='')

        if c == '\\':
            dq.append(i)
        elif c == '/':
            if dq:
                j = dq.pop()
                a = i - j
                tot += a

                while areas and areas[-1][0] > j:
                    a += areas.pop()[1]
                areas.append((i, a))

    print(tot)
    print(len(areas), *map(itemgetter(1), areas)) def main():
    from collections import deque
    from operator import itemgetter

    s = input()

    tot = 0
    areas = []

    dq = deque()
    for i, c in enumerate(s):
        # print(c, end='')

        if c == '\\':
            dq.append(i)
        elif c == '/':
            if dq:
                j = dq.pop()
                a = i - j
                tot += a

                while areas and areas[-1][0] > j:
                    a += areas.pop()[1]
                areas.append((i, a))

    print(tot)
    print(len(areas), *map(itemgetter(1), areas)) main
def main():
    from collections import deque
    from operator import itemgetter

    s = input()

    tot = 0
    areas = []

    dq = deque()
    for i, c in enumerate(s):
        # print(c, end='')

        if c == '\\':
            dq.append(i)
        elif c == '/':
            if dq:
                j = dq.pop()
                a = i - j
                tot += a

                while areas and areas[-1][0] > j:
                    a += areas.pop()[1]
                areas.append((i, a))

    print(tot)
    print(len(areas), *map(itemgetter(1), areas))


if __name__ == '__main__':
    main()

