Input = input()

v_lakes =[]  #個々の湖の面積管理用のstack
idx_stack = [] #地形のindex管理用のstack

for i, c in enumerate(Input):
    if c == "\\":
        idx_stack.append(i)
    elif c == "/" and idx_stack:
        j = idx_stack.pop()
        v = i - j

        while v_lakes and j < v_lakes[-1][0]:
            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) Input = input() Input input() input v_lakes =[] v_lakes [] idx_stack = [] idx_stack [] for i, c in enumerate(Input):
    if c == "\\":
        idx_stack.append(i)
    elif c == "/" and idx_stack:
        j = idx_stack.pop()
        v = i - j

        while v_lakes and j < v_lakes[-1][0]:
            v += v_lakes.pop()[1]

        v_lakes.append((j,v)) i c enumerate(Input) enumerate Input if c == "\\":
        idx_stack.append(i)
    elif c == "/" and idx_stack:
        j = idx_stack.pop()
        v = i - j

        while v_lakes and j < v_lakes[-1][0]:
            v += v_lakes.pop()[1]

        v_lakes.append((j,v)) c == "\\" c "\\" idx_stack.append(i) idx_stack.append idx_stack append i elif c == "/" and idx_stack:
        j = idx_stack.pop()
        v = i - j

        while v_lakes and j < v_lakes[-1][0]:
            v += v_lakes.pop()[1]

        v_lakes.append((j,v)) c == "/" and idx_stack c == "/" c "/" idx_stack 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 j < v_lakes[-1][0]:
            v += v_lakes.pop()[1]

         v_lakes and j < v_lakes[-1][0] v_lakes j < v_lakes[-1][0] j v_lakes[-1][0] [-1] v_lakes -1 0 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 idx_stack = [] [] idx_stack v += v_lakes.pop()[1] v_lakes.pop()[1] v v = [v[1] for v in v_lakes] [v[1] for v in v_lakes] v v = i - j i - j v Input = input() input() Input ans = [len(v_lakes)] [len(v_lakes)] ans v_lakes =[] [] v_lakes j = idx_stack.pop() idx_stack.pop() j
Input = input()

v_lakes =[]  #個々の湖の面積管理用のstack
idx_stack = [] #地形のindex管理用のstack

for i, c in enumerate(Input):
    if c == "\\":
        idx_stack.append(i)
    elif c == "/" and idx_stack:
        j = idx_stack.pop()
        v = i - j

        while v_lakes and j < v_lakes[-1][0]:
            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)
