import sys

readline = sys.stdin.readline

li = []

for i, s in enumerate(readline().strip()):

    if s == "\\":

        li.append([i, 0])

    elif s == "/":

        if li:

            if li[-1][1] == 0:

                li[-1][1] = i - li[-1][0]

            else:

                for j in range(len(li) - 1, -1, -1):

                    if li[j][1] == 0:

                        li = li[:j] + [[li[j][0], sum(tuple(zip(*li[j + 1:]))[1]) + i - li[j][0]]]

                        break

ans = []

for a in li:

    if a[1] != 0:

        ans.append(a[1])

print((sum(ans)))

print((len(ans), *ans))



li1 = []

li2 = []

ans = 0

for i, s in enumerate(eval(input())):

    if s == "\\":

        li1.append(i)

    elif s == "/" and li1:

        j = li1.pop()

        c = i - j

        ans += c

        while li2 and li2[-1][0] > j:

            c += li2[-1][1]

            li2.pop()

        li2.append((j, c))

print(ans)

if li2:

    print((len(li2), *list(zip(*li2))[1]))

else:

    print((0))



import sys

readline = sys.stdin.readline
li = []
for i, s in enumerate(readline().strip()):
    if s == "\\":
        li.append([i, 0])
    elif s == "/":
        if li:
            if li[-1][1] == 0:
                li[-1][1] = i - li[-1][0]
            else:
                for j in range(len(li) - 1, -1, -1):
                    if li[j][1] == 0:
                        li = li[:j] + [
                            [li[j][0], sum(tuple(zip(*li[j + 1 :]))[1]) + i - li[j][0]]
                        ]
                        break
ans = []
for a in li:
    if a[1] != 0:
        ans.append(a[1])
print((sum(ans)))
print((len(ans), *ans))

li1 = []
li2 = []
ans = 0
for i, s in enumerate(eval(input())):
    if s == "\\":
        li1.append(i)
    elif s == "/" and li1:
        j = li1.pop()
        c = i - j
        ans += c
        while li2 and li2[-1][0] > j:
            c += li2[-1][1]
            li2.pop()
        li2.append((j, c))
print(ans)
if li2:
    print((len(li2), *list(zip(*li2))[1]))
else:
    print((0))

-import sys - -readline = sys.stdin.readline -li = [] -for i, s in enumerate(readline().strip()): +li1 = [] +li2 = [] +ans = 0 +for i, s in enumerate(eval(input())): -        li.append([i, 0]) -    elif s == "/": -        if li: -            if li[-1][1] == 0: -                li[-1][1] = i - li[-1][0] -            else: -                for j in range(len(li) - 1, -1, -1): -                    if li[j][1] == 0: -                        li = li[:j] + [ -                            [li[j][0], sum(tuple(zip(*li[j + 1 :]))[1]) + i - li[j][0]] -                        ] -                        break -ans = [] -for a in li: -    if a[1] != 0: -        ans.append(a[1]) -print((sum(ans))) -print((len(ans), *ans)) +        li1.append(i) +    elif s == "/" and li1: +        j = li1.pop() +        c = i - j +        ans += c +        while li2 and li2[-1][0] > j: +            c += li2[-1][1] +            li2.pop() +        li2.append((j, c)) +print(ans) +if li2: +    print((len(li2), *list(zip(*li2))[1])) +else: +    print((0))