def main():
    inputs = str(input())
    stack = []
    pond = [Pond(-1, 0, 0)]

    for i, string in enumerate(inputs):
        if string == "\\":
            stack.append(i)
        elif string == "/":
            try:
                down = stack.pop()
            except  IndexError as err:
                continue
            pond.append(Pond(down, i, i-down))
            while len(pond) > 1:
                newPond = pond.pop()
                prevPond = pond.pop()
                if prevPond.includedBy(newPond):
                    pond.append(prevPond.merge(newPond))
                else:
                    break
            pond.append(prevPond)
            pond.append(newPond)

    printPonds(pond)

def printPonds(pond):
    size = 0
    eachSize = []
    for p in pond:
        size += p.size
        eachSize.append(p.size)
    eachSize[0] = len(pond)-1
    print(size)
    print(*eachSize)

class Pond:
    def __init__(self, x1, x2, size):
        self.x1 = x1
        self.x2 = x2
        self.size = size

    def merge(self, newPond):
        self.x1 = newPond.x1
        self.x2 = newPond.x2
        self.size += newPond.size
        return self

    def includedBy(self, newPond):
        return self.x1 >= newPond.x1 and self.x2 <= newPond.x2

if __name__ == "__main__":
    main() def main():
    inputs = str(input())
    stack = []
    pond = [Pond(-1, 0, 0)]

    for i, string in enumerate(inputs):
        if string == "\\":
            stack.append(i)
        elif string == "/":
            try:
                down = stack.pop()
            except  IndexError as err:
                continue
            pond.append(Pond(down, i, i-down))
            while len(pond) > 1:
                newPond = pond.pop()
                prevPond = pond.pop()
                if prevPond.includedBy(newPond):
                    pond.append(prevPond.merge(newPond))
                else:
                    break
            pond.append(prevPond)
            pond.append(newPond)

    printPonds(pond) main inputs = str(input()) inputs str(input()) str input() input stack = [] stack [] pond = [Pond(-1, 0, 0)] pond [Pond(-1, 0, 0)] Pond(-1, 0, 0) Pond -1 0 0 for i, string in enumerate(inputs):
        if string == "\\":
            stack.append(i)
        elif string == "/":
            try:
                down = stack.pop()
            except  IndexError as err:
                continue
            pond.append(Pond(down, i, i-down))
            while len(pond) > 1:
                newPond = pond.pop()
                prevPond = pond.pop()
                if prevPond.includedBy(newPond):
                    pond.append(prevPond.merge(newPond))
                else:
                    break
            pond.append(prevPond)
            pond.append(newPond)

     i string enumerate(inputs) enumerate inputs if string == "\\":
            stack.append(i)
        elif string == "/":
            try:
                down = stack.pop()
            except  IndexError as err:
                continue
            pond.append(Pond(down, i, i-down))
            while len(pond) > 1:
                newPond = pond.pop()
                prevPond = pond.pop()
                if prevPond.includedBy(newPond):
                    pond.append(prevPond.merge(newPond))
                else:
                    break
            pond.append(prevPond)
            pond.append(newPond)

     string == "\\" string "\\" stack.append(i) stack.append stack append i elif string == "/":
            try:
                down = stack.pop()
            except  IndexError as err:
                continue
            pond.append(Pond(down, i, i-down))
            while len(pond) > 1:
                newPond = pond.pop()
                prevPond = pond.pop()
                if prevPond.includedBy(newPond):
                    pond.append(prevPond.merge(newPond))
                else:
                    break
            pond.append(prevPond)
            pond.append(newPond)

     string == "/" string "/" try:
                down = stack.pop()
            except  IndexError as err:
                continue
             except  IndexError as err:
                continue
             continue down = stack.pop() down stack.pop() stack.pop stack pop pond.append(Pond(down, i, i-down)) pond.append pond append Pond(down, i, i-down) Pond down i i-down i down while len(pond) > 1:
                newPond = pond.pop()
                prevPond = pond.pop()
                if prevPond.includedBy(newPond):
                    pond.append(prevPond.merge(newPond))
                else:
                    break
             len(pond) > 1 len(pond) len pond 1 newPond = pond.pop() newPond pond.pop() pond.pop pond pop prevPond = pond.pop() prevPond pond.pop() pond.pop pond pop if prevPond.includedBy(newPond):
                    pond.append(prevPond.merge(newPond))
                else:
                    break
             prevPond.includedBy(newPond) prevPond.includedBy prevPond includedBy newPond pond.append(prevPond.merge(newPond)) pond.append pond append prevPond.merge(newPond) prevPond.merge prevPond merge newPond break pond.append(prevPond) pond.append pond append prevPond pond.append(newPond) pond.append pond append newPond printPonds(pond) printPonds pond def printPonds(pond):
    size = 0
    eachSize = []
    for p in pond:
        size += p.size
        eachSize.append(p.size)
    eachSize[0] = len(pond)-1
    print(size)
    print(*eachSize) printPonds size = 0 size 0 eachSize = [] eachSize [] for p in pond:
        size += p.size
        eachSize.append(p.size)
     p pond size += p.size size p.size p size eachSize.append(p.size) eachSize.append eachSize append p.size p size eachSize[0] = len(pond)-1 eachSize[0] eachSize 0 len(pond)-1 len(pond) len pond 1 print(size) print size print(*eachSize) print *eachSize eachSize pond pond class Pond:
    def __init__(self, x1, x2, size):
        self.x1 = x1
        self.x2 = x2
        self.size = size

    def merge(self, newPond):
        self.x1 = newPond.x1
        self.x2 = newPond.x2
        self.size += newPond.size
        return self

    def includedBy(self, newPond):
        return self.x1 >= newPond.x1 and self.x2 <= newPond.x2 Pond def __init__(self, x1, x2, size):
        self.x1 = x1
        self.x2 = x2
        self.size = size

     __init__ self.x1 = x1 self.x1 self x1 x1 self.x2 = x2 self.x2 self x2 x2 self.size = size self.size self size size self self x1 x1 x2 x2 size size def merge(self, newPond):
        self.x1 = newPond.x1
        self.x2 = newPond.x2
        self.size += newPond.size
        return self

     merge self.x1 = newPond.x1 self.x1 self x1 newPond.x1 newPond x1 self.x2 = newPond.x2 self.x2 self x2 newPond.x2 newPond x2 self.size += newPond.size self.size self size newPond.size newPond size return self self self self newPond newPond def includedBy(self, newPond):
        return self.x1 >= newPond.x1 and self.x2 <= newPond.x2 includedBy return self.x1 >= newPond.x1 and self.x2 <= newPond.x2 self.x1 >= newPond.x1 and self.x2 <= newPond.x2 self.x1 >= newPond.x1 self.x1 self x1 newPond.x1 newPond x1 self.x2 <= newPond.x2 self.x2 self x2 newPond.x2 newPond x2 self self newPond newPond if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main class Pond:
    def __init__(self, x1, x2, size):
        self.x1 = x1
        self.x2 = x2
        self.size = size

    def merge(self, newPond):
        self.x1 = newPond.x1
        self.x2 = newPond.x2
        self.size += newPond.size
        return self

    def includedBy(self, newPond):
        return self.x1 >= newPond.x1 and self.x2 <= newPond.x2 class Pond:
    def __init__(self, x1, x2, size):
        self.x1 = x1
        self.x2 = x2
        self.size = size

    def merge(self, newPond):
        self.x1 = newPond.x1
        self.x2 = newPond.x2
        self.size += newPond.size
        return self

    def includedBy(self, newPond):
        return self.x1 >= newPond.x1 and self.x2 <= newPond.x2 Pond def printPonds(pond):
    size = 0
    eachSize = []
    for p in pond:
        size += p.size
        eachSize.append(p.size)
    eachSize[0] = len(pond)-1
    print(size)
    print(*eachSize) def printPonds(pond):
    size = 0
    eachSize = []
    for p in pond:
        size += p.size
        eachSize.append(p.size)
    eachSize[0] = len(pond)-1
    print(size)
    print(*eachSize) printPonds def main():
    inputs = str(input())
    stack = []
    pond = [Pond(-1, 0, 0)]

    for i, string in enumerate(inputs):
        if string == "\\":
            stack.append(i)
        elif string == "/":
            try:
                down = stack.pop()
            except  IndexError as err:
                continue
            pond.append(Pond(down, i, i-down))
            while len(pond) > 1:
                newPond = pond.pop()
                prevPond = pond.pop()
                if prevPond.includedBy(newPond):
                    pond.append(prevPond.merge(newPond))
                else:
                    break
            pond.append(prevPond)
            pond.append(newPond)

    printPonds(pond) def main():
    inputs = str(input())
    stack = []
    pond = [Pond(-1, 0, 0)]

    for i, string in enumerate(inputs):
        if string == "\\":
            stack.append(i)
        elif string == "/":
            try:
                down = stack.pop()
            except  IndexError as err:
                continue
            pond.append(Pond(down, i, i-down))
            while len(pond) > 1:
                newPond = pond.pop()
                prevPond = pond.pop()
                if prevPond.includedBy(newPond):
                    pond.append(prevPond.merge(newPond))
                else:
                    break
            pond.append(prevPond)
            pond.append(newPond)

    printPonds(pond) main
def main():
    inputs = str(input())
    stack = []
    pond = [Pond(-1, 0, 0)]

    for i, string in enumerate(inputs):
        if string == "\\":
            stack.append(i)
        elif string == "/":
            try:
                down = stack.pop()
            except  IndexError as err:
                continue
            pond.append(Pond(down, i, i-down))
            while len(pond) > 1:
                newPond = pond.pop()
                prevPond = pond.pop()
                if prevPond.includedBy(newPond):
                    pond.append(prevPond.merge(newPond))
                else:
                    break
            pond.append(prevPond)
            pond.append(newPond)

    printPonds(pond)

def printPonds(pond):
    size = 0
    eachSize = []
    for p in pond:
        size += p.size
        eachSize.append(p.size)
    eachSize[0] = len(pond)-1
    print(size)
    print(*eachSize)

class Pond:
    def __init__(self, x1, x2, size):
        self.x1 = x1
        self.x2 = x2
        self.size = size

    def merge(self, newPond):
        self.x1 = newPond.x1
        self.x2 = newPond.x2
        self.size += newPond.size
        return self

    def includedBy(self, newPond):
        return self.x1 >= newPond.x1 and self.x2 <= newPond.x2

if __name__ == "__main__":
    main()
