mountains = list(input())
stack1, stack2 = [], []

for i, grad in enumerate(mountains):
    if grad == '\\':
        stack1.append(i)
    elif grad == '/':
        if stack1:
          left = stack1.pop(-1)
          right = i
          space = right - left
          while stack2 and stack2[-1][0] > left:
            space += stack2.pop(-1)[1]
          stack2.append([left, space])
    else:
        pass
#print(stack2)
space_list = [space for index, space in stack2]
print(sum(space_list))
print(len(space_list), *space_list) mountains = list(input()) mountains list(input()) list input() input stack1, stack2 = [], [] stack1 [] stack2 [] for i, grad in enumerate(mountains):
    if grad == '\\':
        stack1.append(i)
    elif grad == '/':
        if stack1:
          left = stack1.pop(-1)
          right = i
          space = right - left
          while stack2 and stack2[-1][0] > left:
            space += stack2.pop(-1)[1]
          stack2.append([left, space])
    else:
        pass
#print(stack2) i grad enumerate(mountains) enumerate mountains if grad == '\\':
        stack1.append(i)
    elif grad == '/':
        if stack1:
          left = stack1.pop(-1)
          right = i
          space = right - left
          while stack2 and stack2[-1][0] > left:
            space += stack2.pop(-1)[1]
          stack2.append([left, space])
    else:
        pass
#print(stack2) grad == '\\' grad '\\' stack1.append(i) stack1.append stack1 append i elif grad == '/':
        if stack1:
          left = stack1.pop(-1)
          right = i
          space = right - left
          while stack2 and stack2[-1][0] > left:
            space += stack2.pop(-1)[1]
          stack2.append([left, space])
     grad == '/' grad '/' if stack1:
          left = stack1.pop(-1)
          right = i
          space = right - left
          while stack2 and stack2[-1][0] > left:
            space += stack2.pop(-1)[1]
          stack2.append([left, space])
     stack1 left = stack1.pop(-1) left stack1.pop(-1) stack1.pop stack1 pop -1 right = i right i space = right - left space right - left right left while stack2 and stack2[-1][0] > left:
            space += stack2.pop(-1)[1]
           stack2 and stack2[-1][0] > left stack2 stack2[-1][0] > left stack2[-1][0] [-1] stack2 -1 0 left space += stack2.pop(-1)[1] space stack2.pop(-1)[1] stack2.pop(-1) stack2.pop stack2 pop -1 1 stack2.append([left, space]) stack2.append stack2 append [left, space] left space space for index, space in stack2 for index, space in stack2 index space stack2 for index, space in stack2 space space_list = [space for index, space in stack2] space_list [space for index, space in stack2] print(sum(space_list)) print sum(space_list) sum space_list print(len(space_list), *space_list) print len(space_list) len space_list *space_list space_list space = right - left right - left space space_list = [space for index, space in stack2] [space for index, space in stack2] space_list mountains = list(input()) list(input()) mountains stack2 = [], [] [] stack2 stack1, stack2 = [], [] [] stack1 left = stack1.pop(-1) stack1.pop(-1) left right = i i right space += stack2.pop(-1)[1] stack2.pop(-1)[1] space
mountains = list(input())
stack1, stack2 = [], []

for i, grad in enumerate(mountains):
    if grad == '\\':
        stack1.append(i)
    elif grad == '/':
        if stack1:
          left = stack1.pop(-1)
          right = i
          space = right - left
          while stack2 and stack2[-1][0] > left:
            space += stack2.pop(-1)[1]
          stack2.append([left, space])
    else:
        pass
#print(stack2)
space_list = [space for index, space in stack2]
print(sum(space_list))
print(len(space_list), *space_list)
