N = input()
s1 = []
s2 = []
res = []
ans = []
cnt = 0
for i in range(len(N)):
    if N[i] == "\\":
        s1.append(i)
    elif N[i] == "/" and s1:
        idx = s1.pop()
        tmp = i - idx
        cnt += tmp

        while s2 and idx < s2[-1][0]:
            tmp += s2.pop()[1]
        s2.append((idx, tmp))

res.append(len(s2))
for i in range(len(s2)):
    ans.append(s2[i][1])
res.extend(ans)
print(cnt)
print(" ".join(map(str, res))) N = input() N input() input s1 = [] s1 [] s2 = [] s2 [] res = [] res [] ans = [] ans [] cnt = 0 cnt 0 for i in range(len(N)):
    if N[i] == "\\":
        s1.append(i)
    elif N[i] == "/" and s1:
        idx = s1.pop()
        tmp = i - idx
        cnt += tmp

        while s2 and idx < s2[-1][0]:
            tmp += s2.pop()[1]
        s2.append((idx, tmp)) i range(len(N)) range len(N) len N if N[i] == "\\":
        s1.append(i)
    elif N[i] == "/" and s1:
        idx = s1.pop()
        tmp = i - idx
        cnt += tmp

        while s2 and idx < s2[-1][0]:
            tmp += s2.pop()[1]
        s2.append((idx, tmp)) N[i] == "\\" N[i] N i "\\" s1.append(i) s1.append s1 append i elif N[i] == "/" and s1:
        idx = s1.pop()
        tmp = i - idx
        cnt += tmp

        while s2 and idx < s2[-1][0]:
            tmp += s2.pop()[1]
        s2.append((idx, tmp)) N[i] == "/" and s1 N[i] == "/" N[i] N i "/" s1 idx = s1.pop() idx s1.pop() s1.pop s1 pop tmp = i - idx tmp i - idx i idx cnt += tmp cnt tmp while s2 and idx < s2[-1][0]:
            tmp += s2.pop()[1]
         s2 and idx < s2[-1][0] s2 idx < s2[-1][0] idx s2[-1][0] [-1] s2 -1 0 tmp += s2.pop()[1] tmp s2.pop()[1] s2.pop() s2.pop s2 pop 1 s2.append((idx, tmp)) s2.append s2 append (idx, tmp) idx tmp res.append(len(s2)) res.append res append len(s2) len s2 for i in range(len(s2)):
    ans.append(s2[i][1]) i range(len(s2)) range len(s2) len s2 ans.append(s2[i][1]) ans.append ans append s2[i][1] [i] s2 i 1 res.extend(ans) res.extend res extend ans print(cnt) print cnt print(" ".join(map(str, res))) print " ".join(map(str, res)) " ".join " " join map(str, res) map str res cnt = 0 0 cnt res = [] [] res ans = [] [] ans s1 = [] [] s1 tmp = i - idx i - idx tmp N = input() input() N cnt += tmp tmp cnt idx = s1.pop() s1.pop() idx s2 = [] [] s2 tmp += s2.pop()[1] s2.pop()[1] tmp
N = input()
s1 = []
s2 = []
res = []
ans = []
cnt = 0
for i in range(len(N)):
    if N[i] == "\\":
        s1.append(i)
    elif N[i] == "/" and s1:
        idx = s1.pop()
        tmp = i - idx
        cnt += tmp

        while s2 and idx < s2[-1][0]:
            tmp += s2.pop()[1]
        s2.append((idx, tmp))

res.append(len(s2))
for i in range(len(s2)):
    ans.append(s2[i][1])
res.extend(ans)
print(cnt)
print(" ".join(map(str, res)))
