current_l = 0
stack_s = []
stack_each_area = []
areas = []
for s in input():
#     print(stack_each_area)
    if(s == '\\'):
        stack_s.append(current_l)
    elif(s == '/'):
        if(len(stack_s)==0):
            continue
        left_edge = stack_s.pop(-1)
        area = current_l - left_edge
        areas.append(area)
        
        merged_area = area
        merged_j = []
        for j in range(len(stack_each_area)):
            if( left_edge < stack_each_area[j][0] and stack_each_area[j][0] < current_l):
                merged_area += stack_each_area[j][1]
                merged_j.append(j)
        for del_j in merged_j[::-1]:
            del stack_each_area[del_j]
        stack_each_area.append((current_l, merged_area))
    current_l += 1
print(sum(areas))
if(len(stack_each_area) != 0):
    print(len(stack_each_area), " ".join([ str(lm[1]) for lm in stack_each_area]))
else:
    print(0) current_l = 0 current_l 0 stack_s = [] stack_s [] stack_each_area = [] stack_each_area [] areas = [] areas [] for s in input():
#     print(stack_each_area)
    if(s == '\\'):
        stack_s.append(current_l)
    elif(s == '/'):
        if(len(stack_s)==0):
            continue
        left_edge = stack_s.pop(-1)
        area = current_l - left_edge
        areas.append(area)
        
        merged_area = area
        merged_j = []
        for j in range(len(stack_each_area)):
            if( left_edge < stack_each_area[j][0] and stack_each_area[j][0] < current_l):
                merged_area += stack_each_area[j][1]
                merged_j.append(j)
        for del_j in merged_j[::-1]:
            del stack_each_area[del_j]
        stack_each_area.append((current_l, merged_area))
    current_l += 1 s input() input if(s == '\\'):
        stack_s.append(current_l)
    elif(s == '/'):
        if(len(stack_s)==0):
            continue
        left_edge = stack_s.pop(-1)
        area = current_l - left_edge
        areas.append(area)
        
        merged_area = area
        merged_j = []
        for j in range(len(stack_each_area)):
            if( left_edge < stack_each_area[j][0] and stack_each_area[j][0] < current_l):
                merged_area += stack_each_area[j][1]
                merged_j.append(j)
        for del_j in merged_j[::-1]:
            del stack_each_area[del_j]
        stack_each_area.append((current_l, merged_area))
     s == '\\' s '\\' stack_s.append(current_l) stack_s.append stack_s append current_l elif(s == '/'):
        if(len(stack_s)==0):
            continue
        left_edge = stack_s.pop(-1)
        area = current_l - left_edge
        areas.append(area)
        
        merged_area = area
        merged_j = []
        for j in range(len(stack_each_area)):
            if( left_edge < stack_each_area[j][0] and stack_each_area[j][0] < current_l):
                merged_area += stack_each_area[j][1]
                merged_j.append(j)
        for del_j in merged_j[::-1]:
            del stack_each_area[del_j]
        stack_each_area.append((current_l, merged_area))
     s == '/' s '/' if(len(stack_s)==0):
            continue
         len(stack_s)==0 len(stack_s) len stack_s 0 continue left_edge = stack_s.pop(-1) left_edge stack_s.pop(-1) stack_s.pop stack_s pop -1 area = current_l - left_edge area current_l - left_edge current_l left_edge areas.append(area) areas.append areas append area merged_area = area merged_area area merged_j = [] merged_j [] for j in range(len(stack_each_area)):
            if( left_edge < stack_each_area[j][0] and stack_each_area[j][0] < current_l):
                merged_area += stack_each_area[j][1]
                merged_j.append(j)
         j range(len(stack_each_area)) range len(stack_each_area) len stack_each_area if( left_edge < stack_each_area[j][0] and stack_each_area[j][0] < current_l):
                merged_area += stack_each_area[j][1]
                merged_j.append(j)
         left_edge < stack_each_area[j][0] and stack_each_area[j][0] < current_l left_edge < stack_each_area[j][0] left_edge stack_each_area[j][0] [j] stack_each_area j 0 stack_each_area[j][0] < current_l stack_each_area[j][0] [j] stack_each_area j 0 current_l merged_area += stack_each_area[j][1] merged_area stack_each_area[j][1] [j] stack_each_area j 1 merged_j.append(j) merged_j.append merged_j append j for del_j in merged_j[::-1]:
            del stack_each_area[del_j]
         del_j merged_j[::-1] merged_j ::-1 -1 del stack_each_area[del_j] stack_each_area[del_j] stack_each_area del_j stack_each_area.append((current_l, merged_area)) stack_each_area.append stack_each_area append (current_l, merged_area) current_l merged_area current_l += 1 current_l 1 print(sum(areas)) print sum(areas) sum areas if(len(stack_each_area) != 0):
    print(len(stack_each_area), " ".join([ str(lm[1]) for lm in stack_each_area]))
else:
    print(0) len(stack_each_area) != 0 len(stack_each_area) len stack_each_area 0 str(lm[1]) for lm in stack_each_area for lm in stack_each_area lm stack_each_area for lm in stack_each_area str(lm[1]) str lm[1] lm 1 print(len(stack_each_area), " ".join([ str(lm[1]) for lm in stack_each_area])) print len(stack_each_area) len stack_each_area " ".join([ str(lm[1]) for lm in stack_each_area]) " ".join " " join [ str(lm[1]) for lm in stack_each_area] print(0) print 0 left_edge = stack_s.pop(-1) stack_s.pop(-1) left_edge area = current_l - left_edge current_l - left_edge area stack_each_area = [] [] stack_each_area merged_area += stack_each_area[j][1] stack_each_area[j][1] merged_area current_l = 0 0 current_l stack_s = [] [] stack_s merged_j = [] [] merged_j areas = [] [] areas merged_area = area area merged_area current_l += 1 1 current_l
current_l = 0
stack_s = []
stack_each_area = []
areas = []
for s in input():
#     print(stack_each_area)
    if(s == '\\'):
        stack_s.append(current_l)
    elif(s == '/'):
        if(len(stack_s)==0):
            continue
        left_edge = stack_s.pop(-1)
        area = current_l - left_edge
        areas.append(area)
        
        merged_area = area
        merged_j = []
        for j in range(len(stack_each_area)):
            if( left_edge < stack_each_area[j][0] and stack_each_area[j][0] < current_l):
                merged_area += stack_each_area[j][1]
                merged_j.append(j)
        for del_j in merged_j[::-1]:
            del stack_each_area[del_j]
        stack_each_area.append((current_l, merged_area))
    current_l += 1
print(sum(areas))
if(len(stack_each_area) != 0):
    print(len(stack_each_area), " ".join([ str(lm[1]) for lm in stack_each_area]))
else:
    print(0)
