def cross_section_diagram():

	down = []

	edge = []

	pool = []



	for i, c in enumerate(eval(input())):

		if c == '\\':

			down.append(i)

		elif c == '/' and down:

			left = down.pop()

			area = i - left



			while edge:

				if edge[-1] < left:

					break

				edge.pop()

				area += pool.pop()



			edge.append(left)

			pool.append(area)



	print((sum(pool)))

	print((len(pool), *pool))



if __name__ == '__main__':

	cross_section_diagram()
def cross_section_diagram():

	down = []

	edge = []

	pool = []



	for i, c in enumerate(eval(input())):

		if c == '\\':

			down.append(i)

		elif c == '/' and down:

			left = down.pop()

			area = i - left



			while edge:

				if edge[-1] > left:

					edge.pop()

					area += pool.pop()

				else:

					break



			edge.append(left)

			pool.append(area)



	print((sum(pool)))

	print((len(pool), *pool))



if __name__ == '__main__':

	cross_section_diagram()
def cross_section_diagram():
    down = []
    edge = []
    pool = []
    for i, c in enumerate(eval(input())):
        if c == "\\":
            down.append(i)
        elif c == "/" and down:
            left = down.pop()
            area = i - left
            while edge:
                if edge[-1] < left:
                    break
                edge.pop()
                area += pool.pop()
            edge.append(left)
            pool.append(area)
    print((sum(pool)))
    print((len(pool), *pool))


if __name__ == "__main__":
    cross_section_diagram()

def cross_section_diagram():
    down = []
    edge = []
    pool = []
    for i, c in enumerate(eval(input())):
        if c == "\\":
            down.append(i)
        elif c == "/" and down:
            left = down.pop()
            area = i - left
            while edge:
                if edge[-1] > left:
                    edge.pop()
                    area += pool.pop()
                else:
                    break
            edge.append(left)
            pool.append(area)
    print((sum(pool)))
    print((len(pool), *pool))


if __name__ == "__main__":
    cross_section_diagram()

-                if edge[-1] < left: +                if edge[-1] > left: +                    edge.pop() +                    area += pool.pop() +                else: -                edge.pop() -                area += pool.pop()