import sys

s1 = []
s2 = []
area = []

for i, c in enumerate(sys.stdin.readline()[:-1]):
    if c == '\\':
        s1.append(i)
    elif c == '/' and len(s1) > 0:
        j = s1.pop()
        a = i - j
        while s2:
            if s2[-1] > j:
                s2.pop()
                a += area.pop()
            else:
                break
        s2.append(j)
        area.append(a)

print(sum(area))
print(len(area), *area) import sys sys s1 = [] s1 [] s2 = [] s2 [] area = [] area [] for i, c in enumerate(sys.stdin.readline()[:-1]):
    if c == '\\':
        s1.append(i)
    elif c == '/' and len(s1) > 0:
        j = s1.pop()
        a = i - j
        while s2:
            if s2[-1] > j:
                s2.pop()
                a += area.pop()
            else:
                break
        s2.append(j)
        area.append(a) i c enumerate(sys.stdin.readline()[:-1]) enumerate sys.stdin.readline()[:-1] sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline :-1 -1 if c == '\\':
        s1.append(i)
    elif c == '/' and len(s1) > 0:
        j = s1.pop()
        a = i - j
        while s2:
            if s2[-1] > j:
                s2.pop()
                a += area.pop()
            else:
                break
        s2.append(j)
        area.append(a) c == '\\' c '\\' s1.append(i) s1.append s1 append i elif c == '/' and len(s1) > 0:
        j = s1.pop()
        a = i - j
        while s2:
            if s2[-1] > j:
                s2.pop()
                a += area.pop()
            else:
                break
        s2.append(j)
        area.append(a) c == '/' and len(s1) > 0 c == '/' c '/' len(s1) > 0 len(s1) len s1 0 j = s1.pop() j s1.pop() s1.pop s1 pop a = i - j a i - j i j while s2:
            if s2[-1] > j:
                s2.pop()
                a += area.pop()
            else:
                break
         s2 if s2[-1] > j:
                s2.pop()
                a += area.pop()
            else:
                break
         s2[-1] > j s2[-1] s2 -1 j s2.pop() s2.pop s2 pop a += area.pop() a area.pop() area.pop area pop break s2.append(j) s2.append s2 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 a = i - j i - j a a += area.pop() area.pop() a s1 = [] [] s1 s2 = [] [] s2 area = [] [] area j = s1.pop() s1.pop() j
import sys

s1 = []
s2 = []
area = []

for i, c in enumerate(sys.stdin.readline()[:-1]):
    if c == '\\':
        s1.append(i)
    elif c == '/' and len(s1) > 0:
        j = s1.pop()
        a = i - j
        while s2:
            if s2[-1] > j:
                s2.pop()
                a += area.pop()
            else:
                break
        s2.append(j)
        area.append(a)

print(sum(area))
print(len(area), *area)