def areas(updown: str):
    stack1, stack2 = [], []

    for i, c in enumerate(updown):
        if c == "\\":
            stack1.append(i)
        elif c == "/":
            if len(stack1) == 0:
                continue

            match = stack1.pop()

            # ToDo
            total = 0
            while stack2 and match < stack2[-1][0]:
                _, x = stack2.pop()
                total += x

            total += i - match
            stack2.append((match, total))

        elif c == "_":
            # 何もする必要がない
            pass
        else:
            raise Exception("Invalid Input")

    print(sum(x for _, x in stack2))
    print("{} {}".format(len(stack2), " ".join([str(x) for _, x in stack2])).strip())


# in1 = r"\\//"
# in2 = r"\\///\_/\/\\\\/_/\\///__\\\_\\/_\/_/" + "\\"

s = input().strip()
areas(s)
 def areas(updown: str):
    stack1, stack2 = [], []

    for i, c in enumerate(updown):
        if c == "\\":
            stack1.append(i)
        elif c == "/":
            if len(stack1) == 0:
                continue

            match = stack1.pop()

            # ToDo
            total = 0
            while stack2 and match < stack2[-1][0]:
                _, x = stack2.pop()
                total += x

            total += i - match
            stack2.append((match, total))

        elif c == "_":
            # 何もする必要がない
            pass
        else:
            raise Exception("Invalid Input")

    print(sum(x for _, x in stack2))
    print("{} {}".format(len(stack2), " ".join([str(x) for _, x in stack2])).strip())


# in1 = r"\\//"
# in2 = r"\\///\_/\/\\\\/_/\\///__\\\_\\/_\/_/" + "\\" areas stack1, stack2 = [], [] stack1 [] stack2 [] for i, c in enumerate(updown):
        if c == "\\":
            stack1.append(i)
        elif c == "/":
            if len(stack1) == 0:
                continue

            match = stack1.pop()

            # ToDo
            total = 0
            while stack2 and match < stack2[-1][0]:
                _, x = stack2.pop()
                total += x

            total += i - match
            stack2.append((match, total))

        elif c == "_":
            # 何もする必要がない
            pass
        else:
            raise Exception("Invalid Input")

     i c enumerate(updown) enumerate updown if c == "\\":
            stack1.append(i)
        elif c == "/":
            if len(stack1) == 0:
                continue

            match = stack1.pop()

            # ToDo
            total = 0
            while stack2 and match < stack2[-1][0]:
                _, x = stack2.pop()
                total += x

            total += i - match
            stack2.append((match, total))

        elif c == "_":
            # 何もする必要がない
            pass
        else:
            raise Exception("Invalid Input")

     c == "\\" c "\\" stack1.append(i) stack1.append stack1 append i elif c == "/":
            if len(stack1) == 0:
                continue

            match = stack1.pop()

            # ToDo
            total = 0
            while stack2 and match < stack2[-1][0]:
                _, x = stack2.pop()
                total += x

            total += i - match
            stack2.append((match, total))

         c == "/" c "/" if len(stack1) == 0:
                continue

             len(stack1) == 0 len(stack1) len stack1 0 continue match = stack1.pop() match stack1.pop() stack1.pop stack1 pop total = 0 total 0 while stack2 and match < stack2[-1][0]:
                _, x = stack2.pop()
                total += x

             stack2 and match < stack2[-1][0] stack2 match < stack2[-1][0] match stack2[-1][0] [-1] stack2 -1 0 _, x = stack2.pop() _ stack2.pop() stack2.pop stack2 pop x total += x total x total += i - match total i - match i match stack2.append((match, total)) stack2.append stack2 append (match, total) match total elif c == "_":
            # 何もする必要がない
            pass
         c == "_" c "_" raise Exception("Invalid Input") Exception("Invalid Input") Exception "Invalid Input" print(sum(x for _, x in stack2)) print sum(x for _, x in stack2) sum x str(x) for _, x in stack2 for _, x in stack2 _ x stack2 for _, x in stack2 str(x) str x print("{} {}".format(len(stack2), " ".join([str(x) for _, x in stack2])).strip()) print "{} {}".format(len(stack2), " ".join([str(x) for _, x in stack2])).strip() "{} {}".format(len(stack2), " ".join([str(x) for _, x in stack2])).strip "{} {}".format(len(stack2), " ".join([str(x) for _, x in stack2])) "{} {}".format "{} {}" format len(stack2) len stack2 " ".join([str(x) for _, x in stack2]) " ".join " " join [str(x) for _, x in stack2] strip updown: str updown s = input().strip() s input().strip() ().strip () input strip areas(s) areas s s = input().strip() input().strip() s def areas(updown: str):
    stack1, stack2 = [], []

    for i, c in enumerate(updown):
        if c == "\\":
            stack1.append(i)
        elif c == "/":
            if len(stack1) == 0:
                continue

            match = stack1.pop()

            # ToDo
            total = 0
            while stack2 and match < stack2[-1][0]:
                _, x = stack2.pop()
                total += x

            total += i - match
            stack2.append((match, total))

        elif c == "_":
            # 何もする必要がない
            pass
        else:
            raise Exception("Invalid Input")

    print(sum(x for _, x in stack2))
    print("{} {}".format(len(stack2), " ".join([str(x) for _, x in stack2])).strip())


# in1 = r"\\//"
# in2 = r"\\///\_/\/\\\\/_/\\///__\\\_\\/_\/_/" + "\\" def areas(updown: str):
    stack1, stack2 = [], []

    for i, c in enumerate(updown):
        if c == "\\":
            stack1.append(i)
        elif c == "/":
            if len(stack1) == 0:
                continue

            match = stack1.pop()

            # ToDo
            total = 0
            while stack2 and match < stack2[-1][0]:
                _, x = stack2.pop()
                total += x

            total += i - match
            stack2.append((match, total))

        elif c == "_":
            # 何もする必要がない
            pass
        else:
            raise Exception("Invalid Input")

    print(sum(x for _, x in stack2))
    print("{} {}".format(len(stack2), " ".join([str(x) for _, x in stack2])).strip())


# in1 = r"\\//"
# in2 = r"\\///\_/\/\\\\/_/\\///__\\\_\\/_\/_/" + "\\" areas
def areas(updown: str):
    stack1, stack2 = [], []

    for i, c in enumerate(updown):
        if c == "\\":
            stack1.append(i)
        elif c == "/":
            if len(stack1) == 0:
                continue

            match = stack1.pop()

            # ToDo
            total = 0
            while stack2 and match < stack2[-1][0]:
                _, x = stack2.pop()
                total += x

            total += i - match
            stack2.append((match, total))

        elif c == "_":
            # 何もする必要がない
            pass
        else:
            raise Exception("Invalid Input")

    print(sum(x for _, x in stack2))
    print("{} {}".format(len(stack2), " ".join([str(x) for _, x in stack2])).strip())


# in1 = r"\\//"
# in2 = r"\\///\_/\/\\\\/_/\\///__\\\_\\/_\/_/" + "\\"

s = input().strip()
areas(s)

