lst = list(input())
v_lakes = []
idx_stack = []
for i, c in enumerate(lst):
    if (c == '\\'):
        idx_stack.append(i)
    elif (idx_stack and c == '/'):
        # 対応する'\\'の位置
        j = idx_stack.pop()
        v = i - j
        while (v_lakes and v_lakes[-1][0] > j):
            v += v_lakes.pop()[1]
        v_lakes.append((j, v))
ans = [len(v_lakes)]
v = [v[1] for v in v_lakes]
ans.extend(v)

print(sum(v))
print(*ans) lst = list(input()) lst list(input()) list input() input v_lakes = [] v_lakes [] idx_stack = [] idx_stack [] for i, c in enumerate(lst):
    if (c == '\\'):
        idx_stack.append(i)
    elif (idx_stack and c == '/'):
        # 対応する'\\'の位置
        j = idx_stack.pop()
        v = i - j
        while (v_lakes and v_lakes[-1][0] > j):
            v += v_lakes.pop()[1]
        v_lakes.append((j, v)) i c enumerate(lst) enumerate lst if (c == '\\'):
        idx_stack.append(i)
    elif (idx_stack and c == '/'):
        # 対応する'\\'の位置
        j = idx_stack.pop()
        v = i - j
        while (v_lakes and v_lakes[-1][0] > j):
            v += v_lakes.pop()[1]
        v_lakes.append((j, v)) c == '\\' c '\\' idx_stack.append(i) idx_stack.append idx_stack append i elif (idx_stack and c == '/'):
        # 対応する'\\'の位置
        j = idx_stack.pop()
        v = i - j
        while (v_lakes and v_lakes[-1][0] > j):
            v += v_lakes.pop()[1]
        v_lakes.append((j, v)) idx_stack and c == '/' idx_stack c == '/' c '/' j = idx_stack.pop() j idx_stack.pop() idx_stack.pop idx_stack pop v = i - j v i - j i j while (v_lakes and v_lakes[-1][0] > j):
            v += v_lakes.pop()[1]
         v_lakes and v_lakes[-1][0] > j v_lakes v_lakes[-1][0] > j v_lakes[-1][0] [-1] v_lakes -1 0 j v += v_lakes.pop()[1] v v_lakes.pop()[1] v_lakes.pop() v_lakes.pop v_lakes pop 1 v_lakes.append((j, v)) v_lakes.append v_lakes append (j, v) j v ans = [len(v_lakes)] ans [len(v_lakes)] len(v_lakes) len v_lakes v[1] for v in v_lakes for v in v_lakes v v_lakes for v in v_lakes v[1] v 1 v = [v[1] for v in v_lakes] v [v[1] for v in v_lakes] ans.extend(v) ans.extend ans extend v print(sum(v)) print sum(v) sum v print(*ans) print *ans ans v = i - j i - j v v = [v[1] for v in v_lakes] [v[1] for v in v_lakes] v v += v_lakes.pop()[1] v_lakes.pop()[1] v ans = [len(v_lakes)] [len(v_lakes)] ans lst = list(input()) list(input()) lst j = idx_stack.pop() idx_stack.pop() j v_lakes = [] [] v_lakes idx_stack = [] [] idx_stack
lst = list(input())
v_lakes = []
idx_stack = []
for i, c in enumerate(lst):
    if (c == '\\'):
        idx_stack.append(i)
    elif (idx_stack and c == '/'):
        # 対応する'\\'の位置
        j = idx_stack.pop()
        v = i - j
        while (v_lakes and v_lakes[-1][0] > j):
            v += v_lakes.pop()[1]
        v_lakes.append((j, v))
ans = [len(v_lakes)]
v = [v[1] for v in v_lakes]
ans.extend(v)

print(sum(v))
print(*ans)
