S=input()
sum_a = 0
index = []
area = []
pos = []
for i,s in enumerate(S):
    if(s=="\\"):
        index.append(i)
    if(s=="/" and index):
        tmp = i - index[-1]
        sum_a += tmp
        pop = index.pop()
        while pos and pop < pos[-1]:
            tmp += area.pop()
            pos.pop()
        pos += [pop]
        area += [tmp]
        
print(sum_a)
print(len(area),*(area)) S=input() S input() input sum_a = 0 sum_a 0 index = [] index [] area = [] area [] pos = [] pos [] for i,s in enumerate(S):
    if(s=="\\"):
        index.append(i)
    if(s=="/" and index):
        tmp = i - index[-1]
        sum_a += tmp
        pop = index.pop()
        while pos and pop < pos[-1]:
            tmp += area.pop()
            pos.pop()
        pos += [pop]
        area += [tmp]
         i s enumerate(S) enumerate S if(s=="\\"):
        index.append(i)
     s=="\\" s "\\" index.append(i) index.append index append i if(s=="/" and index):
        tmp = i - index[-1]
        sum_a += tmp
        pop = index.pop()
        while pos and pop < pos[-1]:
            tmp += area.pop()
            pos.pop()
        pos += [pop]
        area += [tmp]
         s=="/" and index s=="/" s "/" index tmp = i - index[-1] tmp i - index[-1] i index[-1] index -1 sum_a += tmp sum_a tmp pop = index.pop() pop index.pop() index.pop index pop while pos and pop < pos[-1]:
            tmp += area.pop()
            pos.pop()
         pos and pop < pos[-1] pos pop < pos[-1] pop pos[-1] pos -1 tmp += area.pop() tmp area.pop() area.pop area pop pos.pop() pos.pop pos pop pos += [pop] pos [pop] pop area += [tmp] area [tmp] tmp print(sum_a) print sum_a print(len(area),*(area)) print len(area) len area *(area) area pos = [] [] pos pop = index.pop() index.pop() pop area += [tmp] [tmp] area S=input() input() S area = [] [] area tmp = i - index[-1] i - index[-1] tmp sum_a += tmp tmp sum_a sum_a = 0 0 sum_a tmp += area.pop() area.pop() tmp pos += [pop] [pop] pos index = [] [] index
S=input()
sum_a = 0
index = []
area = []
pos = []
for i,s in enumerate(S):
    if(s=="\\"):
        index.append(i)
    if(s=="/" and index):
        tmp = i - index[-1]
        sum_a += tmp
        pop = index.pop()
        while pos and pop < pos[-1]:
            tmp += area.pop()
            pos.pop()
        pos += [pop]
        area += [tmp]
        
print(sum_a)
print(len(area),*(area))