# -*- coding: utf-8 -*-

l = input()
S1, S2 = [], []

sum = 0
n = len(l)
for i in range(n):
	if l[i] == "\\":
		S1.append(i)
	elif l[i] == "/" and S1:
		j = S1.pop()
		a = i - j
		sum += a

		while S2 and S2[-1][0] > j:
			a += S2.pop()[1]
		S2.append([j, a])

print(sum)
print(len(S2), *(a for j, a in S2)) l = input() l input() input S1, S2 = [], [] S1 [] S2 [] sum = 0 sum 0 n = len(l) n len(l) len l for i in range(n):
	if l[i] == "\\":
		S1.append(i)
	elif l[i] == "/" and S1:
		j = S1.pop()
		a = i - j
		sum += a

		while S2 and S2[-1][0] > j:
			a += S2.pop()[1]
		S2.append([j, a]) i range(n) range n if l[i] == "\\":
		S1.append(i)
	elif l[i] == "/" and S1:
		j = S1.pop()
		a = i - j
		sum += a

		while S2 and S2[-1][0] > j:
			a += S2.pop()[1]
		S2.append([j, a]) l[i] == "\\" l[i] l i "\\" S1.append(i) S1.append S1 append i elif l[i] == "/" and S1:
		j = S1.pop()
		a = i - j
		sum += a

		while S2 and S2[-1][0] > j:
			a += S2.pop()[1]
		S2.append([j, a]) l[i] == "/" and S1 l[i] == "/" l[i] l i "/" S1 j = S1.pop() j S1.pop() S1.pop S1 pop a = i - j a i - j i j sum += a sum a while S2 and S2[-1][0] > j:
			a += S2.pop()[1]
		 S2 and S2[-1][0] > j S2 S2[-1][0] > j S2[-1][0] [-1] S2 -1 0 j a += S2.pop()[1] a S2.pop()[1] S2.pop() S2.pop S2 pop 1 S2.append([j, a]) S2.append S2 append [j, a] j a print(sum) print sum a for j, a in S2 for j, a in S2 j a S2 for j, a in S2 a print(len(S2), *(a for j, a in S2)) print len(S2) len S2 *(a for j, a in S2) (a for j, a in S2) a = i - j i - j a l = input() input() l a += S2.pop()[1] S2.pop()[1] a sum += a a sum S2 = [], [] [] S2 j = S1.pop() S1.pop() j sum = 0 0 sum S1, S2 = [], [] [] S1 n = len(l) len(l) n
# -*- coding: utf-8 -*-

l = input()
S1, S2 = [], []

sum = 0
n = len(l)
for i in range(n):
	if l[i] == "\\":
		S1.append(i)
	elif l[i] == "/" and S1:
		j = S1.pop()
		a = i - j
		sum += a

		while S2 and S2[-1][0] > j:
			a += S2.pop()[1]
		S2.append([j, a])

print(sum)
print(len(S2), *(a for j, a in S2))