def check(aline):
    pools = []
    leftedge = []

    for i, c in enumerate(aline):
        if c == "\\":
            leftedge.append(i)
        elif c == "_":
            pass
        else:
            if leftedge:
                left = leftedge.pop()
                w = i - left

                while pools and left < pools[-1][0]:
                    w += pools.pop()[1]

                pools.append((left, w))

    return pools


if __name__ == '__main__':

    al = input().strip()
    ps = check(al)

    print(sum([x[1] for x in ps]))
    print(len(ps), *[x[1] for x in ps]) def check(aline):
    pools = []
    leftedge = []

    for i, c in enumerate(aline):
        if c == "\\":
            leftedge.append(i)
        elif c == "_":
            pass
        else:
            if leftedge:
                left = leftedge.pop()
                w = i - left

                while pools and left < pools[-1][0]:
                    w += pools.pop()[1]

                pools.append((left, w))

    return pools check pools = [] pools [] leftedge = [] leftedge [] for i, c in enumerate(aline):
        if c == "\\":
            leftedge.append(i)
        elif c == "_":
            pass
        else:
            if leftedge:
                left = leftedge.pop()
                w = i - left

                while pools and left < pools[-1][0]:
                    w += pools.pop()[1]

                pools.append((left, w))

     i c enumerate(aline) enumerate aline if c == "\\":
            leftedge.append(i)
        elif c == "_":
            pass
        else:
            if leftedge:
                left = leftedge.pop()
                w = i - left

                while pools and left < pools[-1][0]:
                    w += pools.pop()[1]

                pools.append((left, w))

     c == "\\" c "\\" leftedge.append(i) leftedge.append leftedge append i elif c == "_":
            pass
         c == "_" c "_" if leftedge:
                left = leftedge.pop()
                w = i - left

                while pools and left < pools[-1][0]:
                    w += pools.pop()[1]

                pools.append((left, w))

     leftedge left = leftedge.pop() left leftedge.pop() leftedge.pop leftedge pop w = i - left w i - left i left while pools and left < pools[-1][0]:
                    w += pools.pop()[1]

                 pools and left < pools[-1][0] pools left < pools[-1][0] left pools[-1][0] [-1] pools -1 0 w += pools.pop()[1] w pools.pop()[1] pools.pop() pools.pop pools pop 1 pools.append((left, w)) pools.append pools append (left, w) left w return pools pools aline aline if __name__ == '__main__':

    al = input().strip()
    ps = check(al)

    print(sum([x[1] for x in ps]))
    print(len(ps), *[x[1] for x in ps]) __name__ == '__main__' __name__ '__main__' al = input().strip() al input().strip() ().strip () input strip ps = check(al) ps check(al) check al x[1] for x in ps for x in ps x ps for x in ps x[1] x 1 print(sum([x[1] for x in ps])) print sum([x[1] for x in ps]) sum [x[1] for x in ps] x[1] for x in ps for x in ps x ps for x in ps x[1] x 1 print(len(ps), *[x[1] for x in ps]) print len(ps) len ps *[x[1] for x in ps] [x[1] for x in ps] al = input().strip() input().strip() al def check(aline):
    pools = []
    leftedge = []

    for i, c in enumerate(aline):
        if c == "\\":
            leftedge.append(i)
        elif c == "_":
            pass
        else:
            if leftedge:
                left = leftedge.pop()
                w = i - left

                while pools and left < pools[-1][0]:
                    w += pools.pop()[1]

                pools.append((left, w))

    return pools def check(aline):
    pools = []
    leftedge = []

    for i, c in enumerate(aline):
        if c == "\\":
            leftedge.append(i)
        elif c == "_":
            pass
        else:
            if leftedge:
                left = leftedge.pop()
                w = i - left

                while pools and left < pools[-1][0]:
                    w += pools.pop()[1]

                pools.append((left, w))

    return pools check ps = check(al) check(al) ps
def check(aline):
    pools = []
    leftedge = []

    for i, c in enumerate(aline):
        if c == "\\":
            leftedge.append(i)
        elif c == "_":
            pass
        else:
            if leftedge:
                left = leftedge.pop()
                w = i - left

                while pools and left < pools[-1][0]:
                    w += pools.pop()[1]

                pools.append((left, w))

    return pools


if __name__ == '__main__':

    al = input().strip()
    ps = check(al)

    print(sum([x[1] for x in ps]))
    print(len(ps), *[x[1] for x in ps])
