class Stack:
    def __init__(self):
        self.stack = []

    def push(self, value):
        self.stack.append(value)

    def pop(self):
        return self.stack.pop(-1)

    @property
    def isEmpty(self):
        if len(self.stack) == 0:
            return True
        else:
            return False

def main():
    s = input()
    stack_grad = Stack()
    stack_vol = Stack()
    sum_vol = 0

    for i, c in enumerate(s):
        if c == '\\':
            stack_grad.push(i)
        elif c == '/':
            if not stack_grad.isEmpty:
                previ = stack_grad.pop()
                vol = i - previ
                sum_vol += vol
                while not stack_vol.isEmpty:
                    tpl = stack_vol.pop()
                    if previ < tpl[0]:
                        vol += tpl[1]
                    else:
                        stack_vol.push(tpl)
                        break
                stack_vol.push((previ, vol))

    print(sum_vol)
    stack_vol.stack.reverse()
    out = str(len(stack_vol.stack))
    while not stack_vol.isEmpty:
        out += ' {}'.format(stack_vol.pop()[1])
    print(out)


if __name__ == '__main__':
    main() class Stack:
    def __init__(self):
        self.stack = []

    def push(self, value):
        self.stack.append(value)

    def pop(self):
        return self.stack.pop(-1)

    @property
    def isEmpty(self):
        if len(self.stack) == 0:
            return True
        else:
            return False Stack def __init__(self):
        self.stack = []

     __init__ self.stack = [] self.stack self stack [] self self def push(self, value):
        self.stack.append(value)

     push self.stack.append(value) self.stack.append self.stack self stack append value self self value value def pop(self):
        return self.stack.pop(-1)

     pop return self.stack.pop(-1) self.stack.pop(-1) self.stack.pop self.stack self stack pop -1 self self def isEmpty(self):
        if len(self.stack) == 0:
            return True
        else:
            return False isEmpty if len(self.stack) == 0:
            return True
        else:
            return False len(self.stack) == 0 len(self.stack) len self.stack self stack 0 return True True return False False self self @property
     isEmpty property isEmpty def main():
    s = input()
    stack_grad = Stack()
    stack_vol = Stack()
    sum_vol = 0

    for i, c in enumerate(s):
        if c == '\\':
            stack_grad.push(i)
        elif c == '/':
            if not stack_grad.isEmpty:
                previ = stack_grad.pop()
                vol = i - previ
                sum_vol += vol
                while not stack_vol.isEmpty:
                    tpl = stack_vol.pop()
                    if previ < tpl[0]:
                        vol += tpl[1]
                    else:
                        stack_vol.push(tpl)
                        break
                stack_vol.push((previ, vol))

    print(sum_vol)
    stack_vol.stack.reverse()
    out = str(len(stack_vol.stack))
    while not stack_vol.isEmpty:
        out += ' {}'.format(stack_vol.pop()[1])
    print(out) main s = input() s input() input stack_grad = Stack() stack_grad Stack() Stack stack_vol = Stack() stack_vol Stack() Stack sum_vol = 0 sum_vol 0 for i, c in enumerate(s):
        if c == '\\':
            stack_grad.push(i)
        elif c == '/':
            if not stack_grad.isEmpty:
                previ = stack_grad.pop()
                vol = i - previ
                sum_vol += vol
                while not stack_vol.isEmpty:
                    tpl = stack_vol.pop()
                    if previ < tpl[0]:
                        vol += tpl[1]
                    else:
                        stack_vol.push(tpl)
                        break
                stack_vol.push((previ, vol))

     i c enumerate(s) enumerate s if c == '\\':
            stack_grad.push(i)
        elif c == '/':
            if not stack_grad.isEmpty:
                previ = stack_grad.pop()
                vol = i - previ
                sum_vol += vol
                while not stack_vol.isEmpty:
                    tpl = stack_vol.pop()
                    if previ < tpl[0]:
                        vol += tpl[1]
                    else:
                        stack_vol.push(tpl)
                        break
                stack_vol.push((previ, vol))

     c == '\\' c '\\' stack_grad.push(i) stack_grad.push stack_grad push i elif c == '/':
            if not stack_grad.isEmpty:
                previ = stack_grad.pop()
                vol = i - previ
                sum_vol += vol
                while not stack_vol.isEmpty:
                    tpl = stack_vol.pop()
                    if previ < tpl[0]:
                        vol += tpl[1]
                    else:
                        stack_vol.push(tpl)
                        break
                stack_vol.push((previ, vol))

     c == '/' c '/' if not stack_grad.isEmpty:
                previ = stack_grad.pop()
                vol = i - previ
                sum_vol += vol
                while not stack_vol.isEmpty:
                    tpl = stack_vol.pop()
                    if previ < tpl[0]:
                        vol += tpl[1]
                    else:
                        stack_vol.push(tpl)
                        break
                stack_vol.push((previ, vol))

     not stack_grad.isEmpty stack_grad.isEmpty stack_grad isEmpty previ = stack_grad.pop() previ stack_grad.pop() stack_grad.pop stack_grad pop vol = i - previ vol i - previ i previ sum_vol += vol sum_vol vol while not stack_vol.isEmpty:
                    tpl = stack_vol.pop()
                    if previ < tpl[0]:
                        vol += tpl[1]
                    else:
                        stack_vol.push(tpl)
                        break
                 not stack_vol.isEmpty stack_vol.isEmpty stack_vol isEmpty tpl = stack_vol.pop() tpl stack_vol.pop() stack_vol.pop stack_vol pop if previ < tpl[0]:
                        vol += tpl[1]
                    else:
                        stack_vol.push(tpl)
                        break
                 previ < tpl[0] previ tpl[0] tpl 0 vol += tpl[1] vol tpl[1] tpl 1 stack_vol.push(tpl) stack_vol.push stack_vol push tpl break stack_vol.push((previ, vol)) stack_vol.push stack_vol push (previ, vol) previ vol print(sum_vol) print sum_vol stack_vol.stack.reverse() stack_vol.stack.reverse stack_vol.stack stack_vol stack reverse out = str(len(stack_vol.stack)) out str(len(stack_vol.stack)) str len(stack_vol.stack) len stack_vol.stack stack_vol stack while not stack_vol.isEmpty:
        out += ' {}'.format(stack_vol.pop()[1])
     not stack_vol.isEmpty stack_vol.isEmpty stack_vol isEmpty out += ' {}'.format(stack_vol.pop()[1]) out ' {}'.format(stack_vol.pop()[1]) ' {}'.format ' {}' format stack_vol.pop()[1] stack_vol.pop() stack_vol.pop stack_vol pop 1 print(out) print out if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main class Stack:
    def __init__(self):
        self.stack = []

    def push(self, value):
        self.stack.append(value)

    def pop(self):
        return self.stack.pop(-1)

    @property
    def isEmpty(self):
        if len(self.stack) == 0:
            return True
        else:
            return False class Stack:
    def __init__(self):
        self.stack = []

    def push(self, value):
        self.stack.append(value)

    def pop(self):
        return self.stack.pop(-1)

    @property
    def isEmpty(self):
        if len(self.stack) == 0:
            return True
        else:
            return False Stack def main():
    s = input()
    stack_grad = Stack()
    stack_vol = Stack()
    sum_vol = 0

    for i, c in enumerate(s):
        if c == '\\':
            stack_grad.push(i)
        elif c == '/':
            if not stack_grad.isEmpty:
                previ = stack_grad.pop()
                vol = i - previ
                sum_vol += vol
                while not stack_vol.isEmpty:
                    tpl = stack_vol.pop()
                    if previ < tpl[0]:
                        vol += tpl[1]
                    else:
                        stack_vol.push(tpl)
                        break
                stack_vol.push((previ, vol))

    print(sum_vol)
    stack_vol.stack.reverse()
    out = str(len(stack_vol.stack))
    while not stack_vol.isEmpty:
        out += ' {}'.format(stack_vol.pop()[1])
    print(out) def main():
    s = input()
    stack_grad = Stack()
    stack_vol = Stack()
    sum_vol = 0

    for i, c in enumerate(s):
        if c == '\\':
            stack_grad.push(i)
        elif c == '/':
            if not stack_grad.isEmpty:
                previ = stack_grad.pop()
                vol = i - previ
                sum_vol += vol
                while not stack_vol.isEmpty:
                    tpl = stack_vol.pop()
                    if previ < tpl[0]:
                        vol += tpl[1]
                    else:
                        stack_vol.push(tpl)
                        break
                stack_vol.push((previ, vol))

    print(sum_vol)
    stack_vol.stack.reverse()
    out = str(len(stack_vol.stack))
    while not stack_vol.isEmpty:
        out += ' {}'.format(stack_vol.pop()[1])
    print(out) main
class Stack:
    def __init__(self):
        self.stack = []

    def push(self, value):
        self.stack.append(value)

    def pop(self):
        return self.stack.pop(-1)

    @property
    def isEmpty(self):
        if len(self.stack) == 0:
            return True
        else:
            return False

def main():
    s = input()
    stack_grad = Stack()
    stack_vol = Stack()
    sum_vol = 0

    for i, c in enumerate(s):
        if c == '\\':
            stack_grad.push(i)
        elif c == '/':
            if not stack_grad.isEmpty:
                previ = stack_grad.pop()
                vol = i - previ
                sum_vol += vol
                while not stack_vol.isEmpty:
                    tpl = stack_vol.pop()
                    if previ < tpl[0]:
                        vol += tpl[1]
                    else:
                        stack_vol.push(tpl)
                        break
                stack_vol.push((previ, vol))

    print(sum_vol)
    stack_vol.stack.reverse()
    out = str(len(stack_vol.stack))
    while not stack_vol.isEmpty:
        out += ' {}'.format(stack_vol.pop()[1])
    print(out)


if __name__ == '__main__':
    main()