# -*- coding: utf-8 -*-
modelmap = list(input())
S1 = []
S2 = []
A = 0

for i, l in enumerate(modelmap):
    if l == "\\":
        S1.append(i)
    elif l == "/" and len(S1) > 0:
        ip = S1.pop()
        A += i - ip
        L = i - ip
        while len(S2) > 0 and S2[-1][0] > ip:
            L += S2.pop()[1]
        S2.append([ip, L])

print(A)
text2 = "{}".format(len(S2))
for s in S2:
    text2 += " " + str(s[1])
print(text2)             modelmap = list(input()) modelmap list(input()) list input() input S1 = [] S1 [] S2 = [] S2 [] A = 0 A 0 for i, l in enumerate(modelmap):
    if l == "\\":
        S1.append(i)
    elif l == "/" and len(S1) > 0:
        ip = S1.pop()
        A += i - ip
        L = i - ip
        while len(S2) > 0 and S2[-1][0] > ip:
            L += S2.pop()[1]
        S2.append([ip, L]) i l enumerate(modelmap) enumerate modelmap if l == "\\":
        S1.append(i)
    elif l == "/" and len(S1) > 0:
        ip = S1.pop()
        A += i - ip
        L = i - ip
        while len(S2) > 0 and S2[-1][0] > ip:
            L += S2.pop()[1]
        S2.append([ip, L]) l == "\\" l "\\" S1.append(i) S1.append S1 append i elif l == "/" and len(S1) > 0:
        ip = S1.pop()
        A += i - ip
        L = i - ip
        while len(S2) > 0 and S2[-1][0] > ip:
            L += S2.pop()[1]
        S2.append([ip, L]) l == "/" and len(S1) > 0 l == "/" l "/" len(S1) > 0 len(S1) len S1 0 ip = S1.pop() ip S1.pop() S1.pop S1 pop A += i - ip A i - ip i ip L = i - ip L i - ip i ip while len(S2) > 0 and S2[-1][0] > ip:
            L += S2.pop()[1]
         len(S2) > 0 and S2[-1][0] > ip len(S2) > 0 len(S2) len S2 0 S2[-1][0] > ip S2[-1][0] [-1] S2 -1 0 ip L += S2.pop()[1] L S2.pop()[1] S2.pop() S2.pop S2 pop 1 S2.append([ip, L]) S2.append S2 append [ip, L] ip L print(A) print A text2 = "{}".format(len(S2)) text2 "{}".format(len(S2)) "{}".format "{}" format len(S2) len S2 for s in S2:
    text2 += " " + str(s[1]) s S2 text2 += " " + str(s[1]) text2 " " + str(s[1]) " " str(s[1]) str s[1] s 1 print(text2) print text2 L += S2.pop()[1] S2.pop()[1] L text2 += " " + str(s[1]) " " + str(s[1]) text2 A += i - ip i - ip A ip = S1.pop() S1.pop() ip L = i - ip i - ip L S2 = [] [] S2 text2 = "{}".format(len(S2)) "{}".format(len(S2)) text2 modelmap = list(input()) list(input()) modelmap A = 0 0 A S1 = [] [] S1
# -*- coding: utf-8 -*-
modelmap = list(input())
S1 = []
S2 = []
A = 0

for i, l in enumerate(modelmap):
    if l == "\\":
        S1.append(i)
    elif l == "/" and len(S1) > 0:
        ip = S1.pop()
        A += i - ip
        L = i - ip
        while len(S2) > 0 and S2[-1][0] > ip:
            L += S2.pop()[1]
        S2.append([ip, L])

print(A)
text2 = "{}".format(len(S2))
for s in S2:
    text2 += " " + str(s[1])
print(text2)            