from sys import stdin
class Stack():
    def __init__(self):
        self.top=0
        self.top2=0
        self.S=[None]*1000
        self.S2= [None] * 1000
        self.total=0
        self.count=0
        self.haihun=0
        self.arealist=[]
        self.N=0
        self.part=0
        self.compt=False
        self.calc_flag=False
        self.up=0
    def isEmpty(self):
        return self.top==0
    def push(self,fig,finish=0):

        if fig=='\\':
            self.count += 1
            self.S.insert(self.top,self.count)
            self.top += 1


        elif fig=='/':
            self.count += 1
            it=self.pop()
            if self.top > 0: self.top -= 1#0=空

            if it is not None:

                # self.total = self.count - it + self.total  # 合計を図る
                self.S2.insert(self.top2, ([self.count - it, it]))
                self.top2+=1

                while(True):
                    if self.S2[self.top2 - 2] is None:break
                    if self.S2[self.top2-2][1]> it:#中に囲まれている
                        i=self.pop2()
                        if self.top2 > 0: self.top2 -= 1  # 0=空
                        j = self.pop2()
                        if self.top2> 0: self.top2 -= 1  # 0=空
                        self.S2.insert(self.top2,([i[0]+j[0],i[1]]))
                        self.top2 += 1
                    else:break
                if self.pop(flag=1) is None:  # 次がないとき
                    self.N += 1  # 池の数
                    while (True):
                        vari = self.pop2(flag=1)
                        if vari is not None:
                            if it <= vari[1]:
                                self.total += vari[0]
                            else:
                                break
                            self.pop2()
                            if self.top2 > 0: self.top2 -= 1  # 0=空
                        else:
                            break
                    self.part = self.total - self.part
                    self.arealist.append(self.part)
                    self.part = self.total


        elif fig=='_':
            self.count+=1
        if finish==1:
            if self.pop(flag=1) is not  None:  # 途中で終わってしまった
                rest=[]
                while(True):
                    part=self.popup()
                    self.up+=1
                    self.top2-=1
                    if  part is not None:
                        self.arealist.append(part[0])
                        self.N += 1  # 池の数
                        self.total+=part[0]
                    else:break





    def pop(self,flag=0):
        vari=self.S[self.top-1]
        if flag==0:
          self.S[self.top-1]=None
        return vari
    def pop2(self,flag=0):
        vari=self.S2[self.top2-1]
        if flag==0:
          self.S2[self.top2-1]=None
        return vari
    def popup(self):
        vari = self.S2[self.up]
        return vari
    def print(self):#終了
        self.push(None,finish=1)
        self.arealist=self.arealist[::-1]
        self.arealist.append(self.N)
        return self.total,self.arealist
cmd =list(stdin.readline())
Stck=Stack()
for str in cmd:
    Stck.push(str)
total,area=Stck.print()
print(total,end='\n')
print(*area[::-1])



Measured memory_bytes: 6860