from typing import List


class Info:
    def __init__(self, arg_start, arg_end, arg_area):
        self.start = arg_start
        self.end = arg_end
        self.area = arg_area


if __name__ == "__main__":
    LOC: List[int] = []
    POOL: List[Info] = []
    all_symbols = input()
    loc = 0
    total_area = 0

    for symbol in all_symbols:
        if symbol == '\\':
            LOC.append(loc)

        elif symbol == '/':
            if len(LOC) == 0:
                continue

            tmp_start = int(LOC.pop())
            tmp_end = loc
            tmp_area = tmp_end - tmp_start
            total_area += tmp_area

            while len(POOL) > 0:
                # \  / : (tmp_start, tmp_end)
                #  \/ : (POOL[-1].start, POOL[-1].end)
                if tmp_start < POOL[-1].start and POOL[-1].end < tmp_end:
                    tmp_area += POOL[-1].area
                    POOL.pop()
                else:
                    break

            POOL.append(Info(tmp_start, tmp_end, tmp_area))

        else:
            pass

        loc += 1

    print(f"{total_area}")
    print(f"{len(POOL)}", end="")
    while len(POOL) > 0:
        print(f" {POOL[0].area}", end="")
        POOL.pop(0)
    print()
 from typing import List class Info:
    def __init__(self, arg_start, arg_end, arg_area):
        self.start = arg_start
        self.end = arg_end
        self.area = arg_area Info def __init__(self, arg_start, arg_end, arg_area):
        self.start = arg_start
        self.end = arg_end
        self.area = arg_area __init__ self.start = arg_start self.start self start arg_start self.end = arg_end self.end self end arg_end self.area = arg_area self.area self area arg_area self self arg_start arg_start arg_end arg_end arg_area arg_area if __name__ == "__main__":
    LOC: List[int] = []
    POOL: List[Info] = []
    all_symbols = input()
    loc = 0
    total_area = 0

    for symbol in all_symbols:
        if symbol == '\\':
            LOC.append(loc)

        elif symbol == '/':
            if len(LOC) == 0:
                continue

            tmp_start = int(LOC.pop())
            tmp_end = loc
            tmp_area = tmp_end - tmp_start
            total_area += tmp_area

            while len(POOL) > 0:
                # \  / : (tmp_start, tmp_end)
                #  \/ : (POOL[-1].start, POOL[-1].end)
                if tmp_start < POOL[-1].start and POOL[-1].end < tmp_end:
                    tmp_area += POOL[-1].area
                    POOL.pop()
                else:
                    break

            POOL.append(Info(tmp_start, tmp_end, tmp_area))

        else:
            pass

        loc += 1

    print(f"{total_area}")
    print(f"{len(POOL)}", end="")
    while len(POOL) > 0:
        print(f" {POOL[0].area}", end="")
        POOL.pop(0)
    print() __name__ == "__main__" __name__ "__main__" LOC: List[int] = [] LOC [] POOL: List[Info] = [] POOL [] all_symbols = input() all_symbols input() input loc = 0 loc 0 total_area = 0 total_area 0 for symbol in all_symbols:
        if symbol == '\\':
            LOC.append(loc)

        elif symbol == '/':
            if len(LOC) == 0:
                continue

            tmp_start = int(LOC.pop())
            tmp_end = loc
            tmp_area = tmp_end - tmp_start
            total_area += tmp_area

            while len(POOL) > 0:
                # \  / : (tmp_start, tmp_end)
                #  \/ : (POOL[-1].start, POOL[-1].end)
                if tmp_start < POOL[-1].start and POOL[-1].end < tmp_end:
                    tmp_area += POOL[-1].area
                    POOL.pop()
                else:
                    break

            POOL.append(Info(tmp_start, tmp_end, tmp_area))

        else:
            pass

        loc += 1

     symbol all_symbols if symbol == '\\':
            LOC.append(loc)

        elif symbol == '/':
            if len(LOC) == 0:
                continue

            tmp_start = int(LOC.pop())
            tmp_end = loc
            tmp_area = tmp_end - tmp_start
            total_area += tmp_area

            while len(POOL) > 0:
                # \  / : (tmp_start, tmp_end)
                #  \/ : (POOL[-1].start, POOL[-1].end)
                if tmp_start < POOL[-1].start and POOL[-1].end < tmp_end:
                    tmp_area += POOL[-1].area
                    POOL.pop()
                else:
                    break

            POOL.append(Info(tmp_start, tmp_end, tmp_area))

        else:
            pass

         symbol == '\\' symbol '\\' LOC.append(loc) LOC.append LOC append loc elif symbol == '/':
            if len(LOC) == 0:
                continue

            tmp_start = int(LOC.pop())
            tmp_end = loc
            tmp_area = tmp_end - tmp_start
            total_area += tmp_area

            while len(POOL) > 0:
                # \  / : (tmp_start, tmp_end)
                #  \/ : (POOL[-1].start, POOL[-1].end)
                if tmp_start < POOL[-1].start and POOL[-1].end < tmp_end:
                    tmp_area += POOL[-1].area
                    POOL.pop()
                else:
                    break

            POOL.append(Info(tmp_start, tmp_end, tmp_area))

         symbol == '/' symbol '/' if len(LOC) == 0:
                continue

             len(LOC) == 0 len(LOC) len LOC 0 continue tmp_start = int(LOC.pop()) tmp_start int(LOC.pop()) int LOC.pop() LOC.pop LOC pop tmp_end = loc tmp_end loc tmp_area = tmp_end - tmp_start tmp_area tmp_end - tmp_start tmp_end tmp_start total_area += tmp_area total_area tmp_area while len(POOL) > 0:
                # \  / : (tmp_start, tmp_end)
                #  \/ : (POOL[-1].start, POOL[-1].end)
                if tmp_start < POOL[-1].start and POOL[-1].end < tmp_end:
                    tmp_area += POOL[-1].area
                    POOL.pop()
                else:
                    break

             len(POOL) > 0 len(POOL) len POOL 0 if tmp_start < POOL[-1].start and POOL[-1].end < tmp_end:
                    tmp_area += POOL[-1].area
                    POOL.pop()
                else:
                    break

             tmp_start < POOL[-1].start and POOL[-1].end < tmp_end tmp_start < POOL[-1].start tmp_start POOL[-1].start [-1] POOL -1 start POOL[-1].end < tmp_end POOL[-1].end [-1] POOL -1 end tmp_end tmp_area += POOL[-1].area tmp_area POOL[-1].area [-1] POOL -1 area POOL.pop() POOL.pop POOL pop break POOL.append(Info(tmp_start, tmp_end, tmp_area)) POOL.append POOL append Info(tmp_start, tmp_end, tmp_area) Info tmp_start tmp_end tmp_area loc += 1 loc 1 print(f"{total_area}") print f"{total_area}" print(f"{len(POOL)}", end="") print f"{len(POOL)}" end="" end "" while len(POOL) > 0:
        print(f" {POOL[0].area}", end="")
        POOL.pop(0)
     len(POOL) > 0 len(POOL) len POOL 0 print(f" {POOL[0].area}", end="") print f" {POOL[0].area}" end="" end "" POOL.pop(0) POOL.pop POOL pop 0 print() print total_area += tmp_area tmp_area total_area tmp_start = int(LOC.pop()) int(LOC.pop()) tmp_start all_symbols = input() input() all_symbols tmp_area = tmp_end - tmp_start tmp_end - tmp_start tmp_area tmp_end = loc loc tmp_end POOL: List[Info] = [] [] POOL class Info:
    def __init__(self, arg_start, arg_end, arg_area):
        self.start = arg_start
        self.end = arg_end
        self.area = arg_area class Info:
    def __init__(self, arg_start, arg_end, arg_area):
        self.start = arg_start
        self.end = arg_end
        self.area = arg_area Info tmp_area += POOL[-1].area POOL[-1].area tmp_area loc = 0 0 loc total_area = 0 0 total_area LOC: List[int] = [] [] LOC loc += 1 1 loc
from typing import List


class Info:
    def __init__(self, arg_start, arg_end, arg_area):
        self.start = arg_start
        self.end = arg_end
        self.area = arg_area


if __name__ == "__main__":
    LOC: List[int] = []
    POOL: List[Info] = []
    all_symbols = input()
    loc = 0
    total_area = 0

    for symbol in all_symbols:
        if symbol == '\\':
            LOC.append(loc)

        elif symbol == '/':
            if len(LOC) == 0:
                continue

            tmp_start = int(LOC.pop())
            tmp_end = loc
            tmp_area = tmp_end - tmp_start
            total_area += tmp_area

            while len(POOL) > 0:
                # \  / : (tmp_start, tmp_end)
                #  \/ : (POOL[-1].start, POOL[-1].end)
                if tmp_start < POOL[-1].start and POOL[-1].end < tmp_end:
                    tmp_area += POOL[-1].area
                    POOL.pop()
                else:
                    break

            POOL.append(Info(tmp_start, tmp_end, tmp_area))

        else:
            pass

        loc += 1

    print(f"{total_area}")
    print(f"{len(POOL)}", end="")
    while len(POOL) > 0:
        print(f" {POOL[0].area}", end="")
        POOL.pop(0)
    print()

