input_line = input()
stack = []
area = 0
pond_area = 0
pond_areas = []

for i,s in enumerate(input_line):
    if s == '\\':
        stack.append(i)
        if pond_area: 
            pond_areas.append((l, pond_area))
            pond_area = 0
    elif stack and s == '/':
        l = stack.pop()
        area += i - l
        while True:
            if not pond_areas or pond_areas[-1][0] < l: break
            else: 
                pond_area += pond_areas.pop()[1]
        pond_area += i-l

if pond_area > 0: pond_areas.append((l, pond_area))

print(area)
print( " ".join([str(len(pond_areas))] + [str(a[1]) for a in pond_areas]) ) input_line = input() input_line input() input stack = [] stack [] area = 0 area 0 pond_area = 0 pond_area 0 pond_areas = [] pond_areas [] for i,s in enumerate(input_line):
    if s == '\\':
        stack.append(i)
        if pond_area: 
            pond_areas.append((l, pond_area))
            pond_area = 0
    elif stack and s == '/':
        l = stack.pop()
        area += i - l
        while True:
            if not pond_areas or pond_areas[-1][0] < l: break
            else: 
                pond_area += pond_areas.pop()[1]
        pond_area += i-l i s enumerate(input_line) enumerate input_line if s == '\\':
        stack.append(i)
        if pond_area: 
            pond_areas.append((l, pond_area))
            pond_area = 0
    elif stack and s == '/':
        l = stack.pop()
        area += i - l
        while True:
            if not pond_areas or pond_areas[-1][0] < l: break
            else: 
                pond_area += pond_areas.pop()[1]
        pond_area += i-l s == '\\' s '\\' stack.append(i) stack.append stack append i if pond_area: 
            pond_areas.append((l, pond_area))
            pond_area = 0
     pond_area pond_areas.append((l, pond_area)) pond_areas.append pond_areas append (l, pond_area) l pond_area pond_area = 0 pond_area 0 elif stack and s == '/':
        l = stack.pop()
        area += i - l
        while True:
            if not pond_areas or pond_areas[-1][0] < l: break
            else: 
                pond_area += pond_areas.pop()[1]
        pond_area += i-l stack and s == '/' stack s == '/' s '/' l = stack.pop() l stack.pop() stack.pop stack pop area += i - l area i - l i l while True:
            if not pond_areas or pond_areas[-1][0] < l: break
            else: 
                pond_area += pond_areas.pop()[1]
         True if not pond_areas or pond_areas[-1][0] < l: break
            else: 
                pond_area += pond_areas.pop()[1]
         not pond_areas or pond_areas[-1][0] < l not pond_areas pond_areas pond_areas[-1][0] < l pond_areas[-1][0] [-1] pond_areas -1 0 l pond_area += pond_areas.pop()[1] pond_area pond_areas.pop()[1] pond_areas.pop() pond_areas.pop pond_areas pop 1 pond_area += i-l pond_area i-l i l if pond_area > 0: pond_areas.append((l, pond_area)) pond_area > 0 pond_area 0 print(area) print area str(a[1]) for a in pond_areas for a in pond_areas a pond_areas for a in pond_areas str(a[1]) str a[1] a 1 print( " ".join([str(len(pond_areas))] + [str(a[1]) for a in pond_areas]) ) print " ".join([str(len(pond_areas))] + [str(a[1]) for a in pond_areas]) " ".join " " join [str(len(pond_areas))] + [str(a[1]) for a in pond_areas] [str(len(pond_areas))] str(len(pond_areas)) str len(pond_areas) len pond_areas [str(a[1]) for a in pond_areas] pond_area = 0 0 pond_area pond_area += i-l i-l pond_area input_line = input() input() input_line area = 0 0 area pond_areas = [] [] pond_areas pond_area += pond_areas.pop()[1] pond_areas.pop()[1] pond_area stack = [] [] stack area += i - l i - l area pond_area = 0 0 pond_area l = stack.pop() stack.pop() l
input_line = input()
stack = []
area = 0
pond_area = 0
pond_areas = []

for i,s in enumerate(input_line):
    if s == '\\':
        stack.append(i)
        if pond_area: 
            pond_areas.append((l, pond_area))
            pond_area = 0
    elif stack and s == '/':
        l = stack.pop()
        area += i - l
        while True:
            if not pond_areas or pond_areas[-1][0] < l: break
            else: 
                pond_area += pond_areas.pop()[1]
        pond_area += i-l

if pond_area > 0: pond_areas.append((l, pond_area))

print(area)
print( " ".join([str(len(pond_areas))] + [str(a[1]) for a in pond_areas]) )
