S = input()
left, right, area = [], [], []
for i, s in enumerate(list(S)):
    if s == '\\':
        left.append(i)
    if s == '/' and left != []:
        j = left.pop()
        a = i - j
        while right != [] and j < right[-1]:
            right.pop()
            a += area.pop()
        right.append(j)
        area.append(a)
print(sum(area))
print(len(area), *area)
 S = input() S input() input left, right, area = [], [], [] left [] right [] area [] for i, s in enumerate(list(S)):
    if s == '\\':
        left.append(i)
    if s == '/' and left != []:
        j = left.pop()
        a = i - j
        while right != [] and j < right[-1]:
            right.pop()
            a += area.pop()
        right.append(j)
        area.append(a) i s enumerate(list(S)) enumerate list(S) list S if s == '\\':
        left.append(i)
     s == '\\' s '\\' left.append(i) left.append left append i if s == '/' and left != []:
        j = left.pop()
        a = i - j
        while right != [] and j < right[-1]:
            right.pop()
            a += area.pop()
        right.append(j)
        area.append(a) s == '/' and left != [] s == '/' s '/' left != [] left [] j = left.pop() j left.pop() left.pop left pop a = i - j a i - j i j while right != [] and j < right[-1]:
            right.pop()
            a += area.pop()
         right != [] and j < right[-1] right != [] right [] j < right[-1] j right[-1] right -1 right.pop() right.pop right pop a += area.pop() a area.pop() area.pop area pop right.append(j) right.append right append j area.append(a) area.append area append a print(sum(area)) print sum(area) sum area print(len(area), *area) print len(area) len area *area area right, area = [], [], [] [] right left, right, area = [], [], [] [] left area = [], [], [] [] area S = input() input() S j = left.pop() left.pop() j a = i - j i - j a a += area.pop() area.pop() a
S = input()
left, right, area = [], [], []
for i, s in enumerate(list(S)):
    if s == '\\':
        left.append(i)
    if s == '/' and left != []:
        j = left.pop()
        a = i - j
        while right != [] and j < right[-1]:
            right.pop()
            a += area.pop()
        right.append(j)
        area.append(a)
print(sum(area))
print(len(area), *area)

