sum = 0
stack  = []
stack2 = []

str_inpt = input()

for i in range(len(str_inpt)):
  if str_inpt[i] == '\\':
    stack.append(i)
  elif str_inpt[i] == '/':
    if len(stack) < 1: continue
    pop_index = stack.pop(-1)
    area = i - pop_index
    sum += area
    while True:
      if len(stack2) < 1: break
      if stack2[-1][0] < pop_index: break
      if pop_index < stack2[-1][0]:
        pop_stack2 = stack2.pop(-1)
        area += pop_stack2[-1]

    stack2.append([pop_index, area])

print(sum)

if len(stack2) == 0:
  print('0')
else:
  print(str(len(stack2)) + ' ' + ' '.join([str(e[1]) for e in stack2])) sum = 0 sum 0 stack  = [] stack [] stack2 = [] stack2 [] str_inpt = input() str_inpt input() input for i in range(len(str_inpt)):
  if str_inpt[i] == '\\':
    stack.append(i)
  elif str_inpt[i] == '/':
    if len(stack) < 1: continue
    pop_index = stack.pop(-1)
    area = i - pop_index
    sum += area
    while True:
      if len(stack2) < 1: break
      if stack2[-1][0] < pop_index: break
      if pop_index < stack2[-1][0]:
        pop_stack2 = stack2.pop(-1)
        area += pop_stack2[-1]

    stack2.append([pop_index, area]) i range(len(str_inpt)) range len(str_inpt) len str_inpt if str_inpt[i] == '\\':
    stack.append(i)
  elif str_inpt[i] == '/':
    if len(stack) < 1: continue
    pop_index = stack.pop(-1)
    area = i - pop_index
    sum += area
    while True:
      if len(stack2) < 1: break
      if stack2[-1][0] < pop_index: break
      if pop_index < stack2[-1][0]:
        pop_stack2 = stack2.pop(-1)
        area += pop_stack2[-1]

    stack2.append([pop_index, area]) str_inpt[i] == '\\' str_inpt[i] str_inpt i '\\' stack.append(i) stack.append stack append i elif str_inpt[i] == '/':
    if len(stack) < 1: continue
    pop_index = stack.pop(-1)
    area = i - pop_index
    sum += area
    while True:
      if len(stack2) < 1: break
      if stack2[-1][0] < pop_index: break
      if pop_index < stack2[-1][0]:
        pop_stack2 = stack2.pop(-1)
        area += pop_stack2[-1]

    stack2.append([pop_index, area]) str_inpt[i] == '/' str_inpt[i] str_inpt i '/' if len(stack) < 1: continue
     len(stack) < 1 len(stack) len stack 1 pop_index = stack.pop(-1) pop_index stack.pop(-1) stack.pop stack pop -1 area = i - pop_index area i - pop_index i pop_index sum += area sum area while True:
      if len(stack2) < 1: break
      if stack2[-1][0] < pop_index: break
      if pop_index < stack2[-1][0]:
        pop_stack2 = stack2.pop(-1)
        area += pop_stack2[-1]

     True if len(stack2) < 1: break
       len(stack2) < 1 len(stack2) len stack2 1 if stack2[-1][0] < pop_index: break
       stack2[-1][0] < pop_index stack2[-1][0] [-1] stack2 -1 0 pop_index if pop_index < stack2[-1][0]:
        pop_stack2 = stack2.pop(-1)
        area += pop_stack2[-1]

     pop_index < stack2[-1][0] pop_index stack2[-1][0] [-1] stack2 -1 0 pop_stack2 = stack2.pop(-1) pop_stack2 stack2.pop(-1) stack2.pop stack2 pop -1 area += pop_stack2[-1] area pop_stack2[-1] pop_stack2 -1 stack2.append([pop_index, area]) stack2.append stack2 append [pop_index, area] pop_index area print(sum) print sum if len(stack2) == 0:
  print('0')
else:
  print(str(len(stack2)) + ' ' + ' '.join([str(e[1]) for e in stack2])) len(stack2) == 0 len(stack2) len stack2 0 print('0') print '0' str(e[1]) for e in stack2 for e in stack2 e stack2 for e in stack2 str(e[1]) str e[1] e 1 print(str(len(stack2)) + ' ' + ' '.join([str(e[1]) for e in stack2])) print str(len(stack2)) + ' ' + ' '.join([str(e[1]) for e in stack2]) str(len(stack2)) + ' ' str(len(stack2)) str len(stack2) len stack2 ' ' ' '.join([str(e[1]) for e in stack2]) ' '.join ' ' join [str(e[1]) for e in stack2] area += pop_stack2[-1] pop_stack2[-1] area str_inpt = input() input() str_inpt area = i - pop_index i - pop_index area pop_index = stack.pop(-1) stack.pop(-1) pop_index sum += area area sum pop_stack2 = stack2.pop(-1) stack2.pop(-1) pop_stack2 stack2 = [] [] stack2 sum = 0 0 sum stack  = [] [] stack
sum = 0
stack  = []
stack2 = []

str_inpt = input()

for i in range(len(str_inpt)):
  if str_inpt[i] == '\\':
    stack.append(i)
  elif str_inpt[i] == '/':
    if len(stack) < 1: continue
    pop_index = stack.pop(-1)
    area = i - pop_index
    sum += area
    while True:
      if len(stack2) < 1: break
      if stack2[-1][0] < pop_index: break
      if pop_index < stack2[-1][0]:
        pop_stack2 = stack2.pop(-1)
        area += pop_stack2[-1]

    stack2.append([pop_index, area])

print(sum)

if len(stack2) == 0:
  print('0')
else:
  print(str(len(stack2)) + ' ' + ' '.join([str(e[1]) for e in stack2]))
