from collections import deque

s1 = deque()
s2 = deque()

s = input()
totalarea = 0

for i,c in enumerate(s):
    if c == '\\':
        s1.append(i)
    elif s1 and c == '/':
        j = s1.pop()
        area = i - j
        totalarea +=  area
        subarea = area
        while s2 and s2[-1][0] > j:
            subarea += s2[-1][1]
            s2.pop()
        s2.append((j, subarea))

print(totalarea)
print(len(s2), end='')
if s2:
    print(" ",end="")
    areas = [str(puddle[1]) for puddle in s2]
    print(" ".join(areas))
else:
    print("")
 from collections import deque s1 = deque() s1 deque() deque s2 = deque() s2 deque() deque s = input() s input() input totalarea = 0 totalarea 0 for i,c in enumerate(s):
    if c == '\\':
        s1.append(i)
    elif s1 and c == '/':
        j = s1.pop()
        area = i - j
        totalarea +=  area
        subarea = area
        while s2 and s2[-1][0] > j:
            subarea += s2[-1][1]
            s2.pop()
        s2.append((j, subarea)) i c enumerate(s) enumerate s if c == '\\':
        s1.append(i)
    elif s1 and c == '/':
        j = s1.pop()
        area = i - j
        totalarea +=  area
        subarea = area
        while s2 and s2[-1][0] > j:
            subarea += s2[-1][1]
            s2.pop()
        s2.append((j, subarea)) c == '\\' c '\\' s1.append(i) s1.append s1 append i elif s1 and c == '/':
        j = s1.pop()
        area = i - j
        totalarea +=  area
        subarea = area
        while s2 and s2[-1][0] > j:
            subarea += s2[-1][1]
            s2.pop()
        s2.append((j, subarea)) s1 and c == '/' s1 c == '/' c '/' j = s1.pop() j s1.pop() s1.pop s1 pop area = i - j area i - j i j totalarea +=  area totalarea area subarea = area subarea area while s2 and s2[-1][0] > j:
            subarea += s2[-1][1]
            s2.pop()
         s2 and s2[-1][0] > j s2 s2[-1][0] > j s2[-1][0] [-1] s2 -1 0 j subarea += s2[-1][1] subarea s2[-1][1] [-1] s2 -1 1 s2.pop() s2.pop s2 pop s2.append((j, subarea)) s2.append s2 append (j, subarea) j subarea print(totalarea) print totalarea print(len(s2), end='') print len(s2) len s2 end='' end '' if s2:
    print(" ",end="")
    areas = [str(puddle[1]) for puddle in s2]
    print(" ".join(areas))
else:
    print("") s2 print(" ",end="") print " " end="" end "" str(puddle[1]) for puddle in s2 for puddle in s2 puddle s2 for puddle in s2 str(puddle[1]) str puddle[1] puddle 1 areas = [str(puddle[1]) for puddle in s2] areas [str(puddle[1]) for puddle in s2] print(" ".join(areas)) print " ".join(areas) " ".join " " join areas print("") print "" j = s1.pop() s1.pop() j totalarea +=  area area totalarea s1 = deque() deque() s1 areas = [str(puddle[1]) for puddle in s2] [str(puddle[1]) for puddle in s2] areas subarea = area area subarea area = i - j i - j area s2 = deque() deque() s2 s = input() input() s totalarea = 0 0 totalarea subarea += s2[-1][1] s2[-1][1] subarea
from collections import deque

s1 = deque()
s2 = deque()

s = input()
totalarea = 0

for i,c in enumerate(s):
    if c == '\\':
        s1.append(i)
    elif s1 and c == '/':
        j = s1.pop()
        area = i - j
        totalarea +=  area
        subarea = area
        while s2 and s2[-1][0] > j:
            subarea += s2[-1][1]
            s2.pop()
        s2.append((j, subarea))

print(totalarea)
print(len(s2), end='')
if s2:
    print(" ",end="")
    areas = [str(puddle[1]) for puddle in s2]
    print(" ".join(areas))
else:
    print("")

