s = input()
i = 0
S1 = []
S2 = []
water = []
wtot = 0
while i < len(s):
    if s[i] == "\\":
        S1.append(i)
    elif s[i] == '/' and len(S1) != 0:
        w0 = (i - S1[-1])
        wtot += w0
        if len(S2) == 0:
            S2.append((S1[-1], w0))
        else:
            while len(S2) != 0 and S2[-1][0] > S1[-1]:
                w0 += S2[-1][1]
                S2.pop()
            S2.append((S1[-1], w0))
        S1.pop()
    i += 1

ans = str(wtot) + '\n' + str(len(S2))
for p in S2:
    ans += ' ' + str(p[1])
print(ans)
 s = input() s input() input i = 0 i 0 S1 = [] S1 [] S2 = [] S2 [] water = [] water [] wtot = 0 wtot 0 while i < len(s):
    if s[i] == "\\":
        S1.append(i)
    elif s[i] == '/' and len(S1) != 0:
        w0 = (i - S1[-1])
        wtot += w0
        if len(S2) == 0:
            S2.append((S1[-1], w0))
        else:
            while len(S2) != 0 and S2[-1][0] > S1[-1]:
                w0 += S2[-1][1]
                S2.pop()
            S2.append((S1[-1], w0))
        S1.pop()
    i += 1 i < len(s) i len(s) len s if s[i] == "\\":
        S1.append(i)
    elif s[i] == '/' and len(S1) != 0:
        w0 = (i - S1[-1])
        wtot += w0
        if len(S2) == 0:
            S2.append((S1[-1], w0))
        else:
            while len(S2) != 0 and S2[-1][0] > S1[-1]:
                w0 += S2[-1][1]
                S2.pop()
            S2.append((S1[-1], w0))
        S1.pop()
     s[i] == "\\" s[i] s i "\\" S1.append(i) S1.append S1 append i elif s[i] == '/' and len(S1) != 0:
        w0 = (i - S1[-1])
        wtot += w0
        if len(S2) == 0:
            S2.append((S1[-1], w0))
        else:
            while len(S2) != 0 and S2[-1][0] > S1[-1]:
                w0 += S2[-1][1]
                S2.pop()
            S2.append((S1[-1], w0))
        S1.pop()
     s[i] == '/' and len(S1) != 0 s[i] == '/' s[i] s i '/' len(S1) != 0 len(S1) len S1 0 w0 = (i - S1[-1]) w0 i - S1[-1] i S1[-1] S1 -1 wtot += w0 wtot w0 if len(S2) == 0:
            S2.append((S1[-1], w0))
        else:
            while len(S2) != 0 and S2[-1][0] > S1[-1]:
                w0 += S2[-1][1]
                S2.pop()
            S2.append((S1[-1], w0))
         len(S2) == 0 len(S2) len S2 0 S2.append((S1[-1], w0)) S2.append S2 append (S1[-1], w0) S1[-1] S1 -1 w0 while len(S2) != 0 and S2[-1][0] > S1[-1]:
                w0 += S2[-1][1]
                S2.pop()
             len(S2) != 0 and S2[-1][0] > S1[-1] len(S2) != 0 len(S2) len S2 0 S2[-1][0] > S1[-1] S2[-1][0] [-1] S2 -1 0 S1[-1] S1 -1 w0 += S2[-1][1] w0 S2[-1][1] [-1] S2 -1 1 S2.pop() S2.pop S2 pop S2.append((S1[-1], w0)) S2.append S2 append (S1[-1], w0) S1[-1] S1 -1 w0 S1.pop() S1.pop S1 pop i += 1 i 1 ans = str(wtot) + '\n' + str(len(S2)) ans str(wtot) + '\n' + str(len(S2)) str(wtot) + '\n' str(wtot) str wtot '\n' str(len(S2)) str len(S2) len S2 for p in S2:
    ans += ' ' + str(p[1]) p S2 ans += ' ' + str(p[1]) ans ' ' + str(p[1]) ' ' str(p[1]) str p[1] p 1 print(ans) print ans s = input() input() s i += 1 1 i S2 = [] [] S2 S1 = [] [] S1 w0 = (i - S1[-1]) i - S1[-1] w0 w0 += S2[-1][1] S2[-1][1] w0 i = 0 0 i water = [] [] water wtot = 0 0 wtot ans += ' ' + str(p[1]) ' ' + str(p[1]) ans wtot += w0 w0 wtot ans = str(wtot) + '\n' + str(len(S2)) str(wtot) + '\n' + str(len(S2)) ans
s = input()
i = 0
S1 = []
S2 = []
water = []
wtot = 0
while i < len(s):
    if s[i] == "\\":
        S1.append(i)
    elif s[i] == '/' and len(S1) != 0:
        w0 = (i - S1[-1])
        wtot += w0
        if len(S2) == 0:
            S2.append((S1[-1], w0))
        else:
            while len(S2) != 0 and S2[-1][0] > S1[-1]:
                w0 += S2[-1][1]
                S2.pop()
            S2.append((S1[-1], w0))
        S1.pop()
    i += 1

ans = str(wtot) + '\n' + str(len(S2))
for p in S2:
    ans += ' ' + str(p[1])
print(ans)

