def cross_section_diagram():
	down = []
	edge = []
	pool = []

	for i, c in enumerate(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(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) cross_section_diagram down = [] down [] edge = [] edge [] pool = [] pool [] for i, c in enumerate(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)

	 i c enumerate(input()) enumerate input() 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)

	 c == '\\' c '\\' down.append(i) down.append 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)

	 c == '/' and down c == '/' c '/' down left = down.pop() left down.pop() down.pop down pop area = i - left area i - left i left while edge:
				if edge[-1] < left:
					break
				edge.pop()
				area += pool.pop()

			 edge if edge[-1] < left:
					break
				 edge[-1] < left edge[-1] edge -1 left break edge.pop() edge.pop edge pop area += pool.pop() area pool.pop() pool.pop pool pop edge.append(left) edge.append edge append left pool.append(area) pool.append pool append area print(sum(pool)) print sum(pool) sum pool print(len(pool), *pool) print len(pool) len pool *pool pool if __name__ == '__main__':
	cross_section_diagram() __name__ == '__main__' __name__ '__main__' cross_section_diagram() cross_section_diagram def cross_section_diagram():
	down = []
	edge = []
	pool = []

	for i, c in enumerate(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) def cross_section_diagram():
	down = []
	edge = []
	pool = []

	for i, c in enumerate(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) cross_section_diagram
def cross_section_diagram():
	down = []
	edge = []
	pool = []

	for i, c in enumerate(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()