ch = input()
area_idx = []
area = []
for i, c in enumerate(ch):
    if c == '\\':
        area_idx.append(i)
    elif c == '/' and area_idx:
        j = area_idx.pop() 
        v = i-j
        while area and j < area[-1][0]:
            v += area.pop()[1]
        area.append((j, v))
n = len(area)
a = [v[1] for v in area]
print(sum(a))
print(n, *a) ch = input() ch input() input area_idx = [] area_idx [] area = [] area [] for i, c in enumerate(ch):
    if c == '\\':
        area_idx.append(i)
    elif c == '/' and area_idx:
        j = area_idx.pop() 
        v = i-j
        while area and j < area[-1][0]:
            v += area.pop()[1]
        area.append((j, v)) i c enumerate(ch) enumerate ch if c == '\\':
        area_idx.append(i)
    elif c == '/' and area_idx:
        j = area_idx.pop() 
        v = i-j
        while area and j < area[-1][0]:
            v += area.pop()[1]
        area.append((j, v)) c == '\\' c '\\' area_idx.append(i) area_idx.append area_idx append i elif c == '/' and area_idx:
        j = area_idx.pop() 
        v = i-j
        while area and j < area[-1][0]:
            v += area.pop()[1]
        area.append((j, v)) c == '/' and area_idx c == '/' c '/' area_idx j = area_idx.pop() j area_idx.pop() area_idx.pop area_idx pop v = i-j v i-j i j while area and j < area[-1][0]:
            v += area.pop()[1]
         area and j < area[-1][0] area j < area[-1][0] j area[-1][0] [-1] area -1 0 v += area.pop()[1] v area.pop()[1] area.pop() area.pop area pop 1 area.append((j, v)) area.append area append (j, v) j v n = len(area) n len(area) len area v[1] for v in area for v in area v area for v in area v[1] v 1 a = [v[1] for v in area] a [v[1] for v in area] print(sum(a)) print sum(a) sum a print(n, *a) print n *a a a = [v[1] for v in area] [v[1] for v in area] a ch = input() input() ch area = [] [] area area_idx = [] [] area_idx v += area.pop()[1] area.pop()[1] v n = len(area) len(area) n v = i-j i-j v j = area_idx.pop() area_idx.pop() j
ch = input()
area_idx = []
area = []
for i, c in enumerate(ch):
    if c == '\\':
        area_idx.append(i)
    elif c == '/' and area_idx:
        j = area_idx.pop() 
        v = i-j
        while area and j < area[-1][0]:
            v += area.pop()[1]
        area.append((j, v))
n = len(area)
a = [v[1] for v in area]
print(sum(a))
print(n, *a)
