from collections import deque

list = list(input())

queue = deque([]) 
queue2 = []
total = 0

for i in range(len(list)):
        if list[i] == '\\':
                queue.append(i)
        elif list[i] == '/' and len(queue) > 0:
                j = queue.pop()
                total += (i - j)
                temp = i - j
                while len(queue2) > 0 and queue2[len(queue2) - 1][0] > j:
                        temp += queue2[len(queue2) - 1][1]
                        queue2.pop()
                queue2.append([j, temp])
strResult = [str(len(queue2))]
for i in range(len(queue2)):
        strResult.append(str(queue2[i][1]))

print(total)
print(" ".join(strResult)) from collections import deque list = list(input()) list list(input()) list input() input queue = deque([]) queue deque([]) deque [] queue2 = [] queue2 [] total = 0 total 0 for i in range(len(list)):
        if list[i] == '\\':
                queue.append(i)
        elif list[i] == '/' and len(queue) > 0:
                j = queue.pop()
                total += (i - j)
                temp = i - j
                while len(queue2) > 0 and queue2[len(queue2) - 1][0] > j:
                        temp += queue2[len(queue2) - 1][1]
                        queue2.pop()
                queue2.append([j, temp]) i range(len(list)) range len(list) len list if list[i] == '\\':
                queue.append(i)
        elif list[i] == '/' and len(queue) > 0:
                j = queue.pop()
                total += (i - j)
                temp = i - j
                while len(queue2) > 0 and queue2[len(queue2) - 1][0] > j:
                        temp += queue2[len(queue2) - 1][1]
                        queue2.pop()
                queue2.append([j, temp]) list[i] == '\\' list[i] list i '\\' queue.append(i) queue.append queue append i elif list[i] == '/' and len(queue) > 0:
                j = queue.pop()
                total += (i - j)
                temp = i - j
                while len(queue2) > 0 and queue2[len(queue2) - 1][0] > j:
                        temp += queue2[len(queue2) - 1][1]
                        queue2.pop()
                queue2.append([j, temp]) list[i] == '/' and len(queue) > 0 list[i] == '/' list[i] list i '/' len(queue) > 0 len(queue) len queue 0 j = queue.pop() j queue.pop() queue.pop queue pop total += (i - j) total i - j i j temp = i - j temp i - j i j while len(queue2) > 0 and queue2[len(queue2) - 1][0] > j:
                        temp += queue2[len(queue2) - 1][1]
                        queue2.pop()
                 len(queue2) > 0 and queue2[len(queue2) - 1][0] > j len(queue2) > 0 len(queue2) len queue2 0 queue2[len(queue2) - 1][0] > j queue2[len(queue2) - 1][0] [len(queue2) - 1] queue2 len(queue2) - 1 len(queue2) len queue2 1 0 j temp += queue2[len(queue2) - 1][1] temp queue2[len(queue2) - 1][1] [len(queue2) - 1] queue2 len(queue2) - 1 len(queue2) len queue2 1 1 queue2.pop() queue2.pop queue2 pop queue2.append([j, temp]) queue2.append queue2 append [j, temp] j temp strResult = [str(len(queue2))] strResult [str(len(queue2))] str(len(queue2)) str len(queue2) len queue2 for i in range(len(queue2)):
        strResult.append(str(queue2[i][1])) i range(len(queue2)) range len(queue2) len queue2 strResult.append(str(queue2[i][1])) strResult.append strResult append str(queue2[i][1]) str queue2[i][1] [i] queue2 i 1 print(total) print total print(" ".join(strResult)) print " ".join(strResult) " ".join " " join strResult queue2 = [] [] queue2 total = 0 0 total strResult = [str(len(queue2))] [str(len(queue2))] strResult total += (i - j) i - j total j = queue.pop() queue.pop() j temp = i - j i - j temp list = list(input()) list(input()) list temp += queue2[len(queue2) - 1][1] queue2[len(queue2) - 1][1] temp queue = deque([]) deque([]) queue
from collections import deque

list = list(input())

queue = deque([]) 
queue2 = []
total = 0

for i in range(len(list)):
        if list[i] == '\\':
                queue.append(i)
        elif list[i] == '/' and len(queue) > 0:
                j = queue.pop()
                total += (i - j)
                temp = i - j
                while len(queue2) > 0 and queue2[len(queue2) - 1][0] > j:
                        temp += queue2[len(queue2) - 1][1]
                        queue2.pop()
                queue2.append([j, temp])
strResult = [str(len(queue2))]
for i in range(len(queue2)):
        strResult.append(str(queue2[i][1]))

print(total)
print(" ".join(strResult))
