inpu = input()
back = list(r"\\")[0]

stack = []
area = 0
area_sub = []
for i,symbol in enumerate(inpu):
    if symbol == back:
        stack.append(i)
        #print(back)
    elif symbol == "/":
        #print(symbol)
        if len(stack)>0:
            a = stack.pop()
            area += i-a
            
            area2 = 0
            while len(area_sub) and a<area_sub[-1][0]:
                pre = area_sub.pop()
                area2 += pre[1]
            area2 += i-a 
            area_sub.append([a,area2])
print(area)

#print(" ".join(a for a in area_sub))
if len(area_sub) > 0: 
    print(len(area_sub), end=" ")
    ar = [a[1] for a in area_sub]
    print(*ar)
else:
    print(len(area_sub)) inpu = input() inpu input() input back = list(r"\\")[0] back list(r"\\")[0] (r"\\") list r"\\" 0 stack = [] stack [] area = 0 area 0 area_sub = [] area_sub [] for i,symbol in enumerate(inpu):
    if symbol == back:
        stack.append(i)
        #print(back)
    elif symbol == "/":
        #print(symbol)
        if len(stack)>0:
            a = stack.pop()
            area += i-a
            
            area2 = 0
            while len(area_sub) and a<area_sub[-1][0]:
                pre = area_sub.pop()
                area2 += pre[1]
            area2 += i-a 
            area_sub.append([a,area2]) i symbol enumerate(inpu) enumerate inpu if symbol == back:
        stack.append(i)
        #print(back)
    elif symbol == "/":
        #print(symbol)
        if len(stack)>0:
            a = stack.pop()
            area += i-a
            
            area2 = 0
            while len(area_sub) and a<area_sub[-1][0]:
                pre = area_sub.pop()
                area2 += pre[1]
            area2 += i-a 
            area_sub.append([a,area2]) symbol == back symbol back stack.append(i) stack.append stack append i elif symbol == "/":
        #print(symbol)
        if len(stack)>0:
            a = stack.pop()
            area += i-a
            
            area2 = 0
            while len(area_sub) and a<area_sub[-1][0]:
                pre = area_sub.pop()
                area2 += pre[1]
            area2 += i-a 
            area_sub.append([a,area2]) symbol == "/" symbol "/" if len(stack)>0:
            a = stack.pop()
            area += i-a
            
            area2 = 0
            while len(area_sub) and a<area_sub[-1][0]:
                pre = area_sub.pop()
                area2 += pre[1]
            area2 += i-a 
            area_sub.append([a,area2]) len(stack)>0 len(stack) len stack 0 a = stack.pop() a stack.pop() stack.pop stack pop area += i-a area i-a i a area2 = 0 area2 0 while len(area_sub) and a<area_sub[-1][0]:
                pre = area_sub.pop()
                area2 += pre[1]
             len(area_sub) and a<area_sub[-1][0] len(area_sub) len area_sub a<area_sub[-1][0] a area_sub[-1][0] [-1] area_sub -1 0 pre = area_sub.pop() pre area_sub.pop() area_sub.pop area_sub pop area2 += pre[1] area2 pre[1] pre 1 area2 += i-a area2 i-a i a area_sub.append([a,area2]) area_sub.append area_sub append [a,area2] a area2 print(area) print area if len(area_sub) > 0: 
    print(len(area_sub), end=" ")
    ar = [a[1] for a in area_sub]
    print(*ar)
else:
    print(len(area_sub)) len(area_sub) > 0 len(area_sub) len area_sub 0 print(len(area_sub), end=" ") print len(area_sub) len area_sub end=" " end " " a[1] for a in area_sub for a in area_sub a area_sub for a in area_sub a[1] a 1 ar = [a[1] for a in area_sub] ar [a[1] for a in area_sub] print(*ar) print *ar ar print(len(area_sub)) print len(area_sub) len area_sub area2 += i-a i-a area2 back = list(r"\\")[0] list(r"\\")[0] back area = 0 0 area area2 = 0 0 area2 area2 += pre[1] pre[1] area2 area_sub = [] [] area_sub a = stack.pop() stack.pop() a stack = [] [] stack pre = area_sub.pop() area_sub.pop() pre ar = [a[1] for a in area_sub] [a[1] for a in area_sub] ar area += i-a i-a area inpu = input() input() inpu
inpu = input()
back = list(r"\\")[0]

stack = []
area = 0
area_sub = []
for i,symbol in enumerate(inpu):
    if symbol == back:
        stack.append(i)
        #print(back)
    elif symbol == "/":
        #print(symbol)
        if len(stack)>0:
            a = stack.pop()
            area += i-a
            
            area2 = 0
            while len(area_sub) and a<area_sub[-1][0]:
                pre = area_sub.pop()
                area2 += pre[1]
            area2 += i-a 
            area_sub.append([a,area2])
print(area)

#print(" ".join(a for a in area_sub))
if len(area_sub) > 0: 
    print(len(area_sub), end=" ")
    ar = [a[1] for a in area_sub]
    print(*ar)
else:
    print(len(area_sub))
