lakes = []  # [(左岸位置, 断面積)]
lefts = []  # lefts[i]: まだ対になっていない上から i 番目の左岸位置
for i, c in enumerate(input()):
	if c == '\\':
		lefts.append(i)
	elif c == '/':
		if lefts:
			left = lefts.pop()
			area = i - left
			while lakes:
				sub_left, sub_area = lakes[-1]
				if left < sub_left:
					area += sub_area
					lakes.pop()
				else:
					break
			lakes.append((left, area))

L = [lake[1] for lake in lakes]
print(sum(L))
print(len(L), *L) lakes = [] lakes [] lefts = [] lefts [] for i, c in enumerate(input()):
	if c == '\\':
		lefts.append(i)
	elif c == '/':
		if lefts:
			left = lefts.pop()
			area = i - left
			while lakes:
				sub_left, sub_area = lakes[-1]
				if left < sub_left:
					area += sub_area
					lakes.pop()
				else:
					break
			lakes.append((left, area)) i c enumerate(input()) enumerate input() input if c == '\\':
		lefts.append(i)
	elif c == '/':
		if lefts:
			left = lefts.pop()
			area = i - left
			while lakes:
				sub_left, sub_area = lakes[-1]
				if left < sub_left:
					area += sub_area
					lakes.pop()
				else:
					break
			lakes.append((left, area)) c == '\\' c '\\' lefts.append(i) lefts.append lefts append i elif c == '/':
		if lefts:
			left = lefts.pop()
			area = i - left
			while lakes:
				sub_left, sub_area = lakes[-1]
				if left < sub_left:
					area += sub_area
					lakes.pop()
				else:
					break
			lakes.append((left, area)) c == '/' c '/' if lefts:
			left = lefts.pop()
			area = i - left
			while lakes:
				sub_left, sub_area = lakes[-1]
				if left < sub_left:
					area += sub_area
					lakes.pop()
				else:
					break
			lakes.append((left, area)) lefts left = lefts.pop() left lefts.pop() lefts.pop lefts pop area = i - left area i - left i left while lakes:
				sub_left, sub_area = lakes[-1]
				if left < sub_left:
					area += sub_area
					lakes.pop()
				else:
					break
			 lakes sub_left, sub_area = lakes[-1] sub_left lakes[-1] lakes -1 sub_area if left < sub_left:
					area += sub_area
					lakes.pop()
				else:
					break
			 left < sub_left left sub_left area += sub_area area sub_area lakes.pop() lakes.pop lakes pop break lakes.append((left, area)) lakes.append lakes append (left, area) left area lake[1] for lake in lakes for lake in lakes lake lakes for lake in lakes lake[1] lake 1 L = [lake[1] for lake in lakes] L [lake[1] for lake in lakes] print(sum(L)) print sum(L) sum L print(len(L), *L) print len(L) len L *L L area = i - left i - left area sub_left, sub_area = lakes[-1] lakes[-1] sub_left area += sub_area sub_area area L = [lake[1] for lake in lakes] [lake[1] for lake in lakes] L lakes = [] [] lakes sub_area = lakes[-1] lakes[-1] sub_area lefts = [] [] lefts left = lefts.pop() lefts.pop() left
lakes = []  # [(左岸位置, 断面積)]
lefts = []  # lefts[i]: まだ対になっていない上から i 番目の左岸位置
for i, c in enumerate(input()):
	if c == '\\':
		lefts.append(i)
	elif c == '/':
		if lefts:
			left = lefts.pop()
			area = i - left
			while lakes:
				sub_left, sub_area = lakes[-1]
				if left < sub_left:
					area += sub_area
					lakes.pop()
				else:
					break
			lakes.append((left, area))

L = [lake[1] for lake in lakes]
print(sum(L))
print(len(L), *L)
