class Pond:
    def __init__(self, arg_left, arg_area):
        self.left = arg_left
        self.area = arg_area

form = input()
stack = []
stack2 = []
totalArea = 0
for i in range(len(form)):
    #'/'以外なら積む
    tmpForm = form[i]
    if tmpForm == '\\':
        stack.append(i)
    #'/'なら直前の\を探しに行く
    elif tmpForm == '/' and len(stack) > 0:
        xLeft = stack.pop()
        xRight = i
        tmpArea = xRight - xLeft
        totalArea += tmpArea

        #池が連続する場合の処理
        while len(stack2) > 0 and stack2[-1].left > xLeft:
            tmpArea += stack2.pop().area

        stack2.append(Pond(xLeft, tmpArea)) #新たな池を登録

print(totalArea)
ans = []
ans.append(len(stack2))
for pond in stack2:
    ans.append(pond.area)
print(' '.join(map(str, ans)))
 class Pond:
    def __init__(self, arg_left, arg_area):
        self.left = arg_left
        self.area = arg_area Pond def __init__(self, arg_left, arg_area):
        self.left = arg_left
        self.area = arg_area __init__ self.left = arg_left self.left self left arg_left self.area = arg_area self.area self area arg_area self self arg_left arg_left arg_area arg_area form = input() form input() input stack = [] stack [] stack2 = [] stack2 [] totalArea = 0 totalArea 0 for i in range(len(form)):
    #'/'以外なら積む
    tmpForm = form[i]
    if tmpForm == '\\':
        stack.append(i)
    #'/'なら直前の\を探しに行く
    elif tmpForm == '/' and len(stack) > 0:
        xLeft = stack.pop()
        xRight = i
        tmpArea = xRight - xLeft
        totalArea += tmpArea

        #池が連続する場合の処理
        while len(stack2) > 0 and stack2[-1].left > xLeft:
            tmpArea += stack2.pop().area

        stack2.append(Pond(xLeft, tmpArea)) #新たな池を登録 i range(len(form)) range len(form) len form tmpForm = form[i] tmpForm form[i] form i if tmpForm == '\\':
        stack.append(i)
    #'/'なら直前の\を探しに行く
    elif tmpForm == '/' and len(stack) > 0:
        xLeft = stack.pop()
        xRight = i
        tmpArea = xRight - xLeft
        totalArea += tmpArea

        #池が連続する場合の処理
        while len(stack2) > 0 and stack2[-1].left > xLeft:
            tmpArea += stack2.pop().area

        stack2.append(Pond(xLeft, tmpArea)) #新たな池を登録 tmpForm == '\\' tmpForm '\\' stack.append(i) stack.append stack append i elif tmpForm == '/' and len(stack) > 0:
        xLeft = stack.pop()
        xRight = i
        tmpArea = xRight - xLeft
        totalArea += tmpArea

        #池が連続する場合の処理
        while len(stack2) > 0 and stack2[-1].left > xLeft:
            tmpArea += stack2.pop().area

        stack2.append(Pond(xLeft, tmpArea)) #新たな池を登録 tmpForm == '/' and len(stack) > 0 tmpForm == '/' tmpForm '/' len(stack) > 0 len(stack) len stack 0 xLeft = stack.pop() xLeft stack.pop() stack.pop stack pop xRight = i xRight i tmpArea = xRight - xLeft tmpArea xRight - xLeft xRight xLeft totalArea += tmpArea totalArea tmpArea while len(stack2) > 0 and stack2[-1].left > xLeft:
            tmpArea += stack2.pop().area

         len(stack2) > 0 and stack2[-1].left > xLeft len(stack2) > 0 len(stack2) len stack2 0 stack2[-1].left > xLeft stack2[-1].left [-1] stack2 -1 left xLeft tmpArea += stack2.pop().area tmpArea stack2.pop().area stack2.pop() stack2.pop stack2 pop area stack2.append(Pond(xLeft, tmpArea)) stack2.append stack2 append Pond(xLeft, tmpArea) Pond xLeft tmpArea print(totalArea) print totalArea ans = [] ans [] ans.append(len(stack2)) ans.append ans append len(stack2) len stack2 for pond in stack2:
    ans.append(pond.area) pond stack2 ans.append(pond.area) ans.append ans append pond.area pond area print(' '.join(map(str, ans))) print ' '.join(map(str, ans)) ' '.join ' ' join map(str, ans) map str ans stack = [] [] stack totalArea = 0 0 totalArea tmpArea += stack2.pop().area stack2.pop().area tmpArea xLeft = stack.pop() stack.pop() xLeft tmpForm = form[i] form[i] tmpForm ans = [] [] ans form = input() input() form tmpArea = xRight - xLeft xRight - xLeft tmpArea totalArea += tmpArea tmpArea totalArea class Pond:
    def __init__(self, arg_left, arg_area):
        self.left = arg_left
        self.area = arg_area class Pond:
    def __init__(self, arg_left, arg_area):
        self.left = arg_left
        self.area = arg_area Pond stack2 = [] [] stack2 xRight = i i xRight
class Pond:
    def __init__(self, arg_left, arg_area):
        self.left = arg_left
        self.area = arg_area

form = input()
stack = []
stack2 = []
totalArea = 0
for i in range(len(form)):
    #'/'以外なら積む
    tmpForm = form[i]
    if tmpForm == '\\':
        stack.append(i)
    #'/'なら直前の\を探しに行く
    elif tmpForm == '/' and len(stack) > 0:
        xLeft = stack.pop()
        xRight = i
        tmpArea = xRight - xLeft
        totalArea += tmpArea

        #池が連続する場合の処理
        while len(stack2) > 0 and stack2[-1].left > xLeft:
            tmpArea += stack2.pop().area

        stack2.append(Pond(xLeft, tmpArea)) #新たな池を登録

print(totalArea)
ans = []
ans.append(len(stack2))
for pond in stack2:
    ans.append(pond.area)
print(' '.join(map(str, ans)))

