from collections import deque
x = input()
A = 0
S1 = deque()
S2 = deque()

for i in range(len(x)):
    if x[i] == "\\":
        S1.append(i)
    elif x[i] == "/" and len(S1) > 0 :
        j = S1.pop()
        A += i - j
        a  = i - j
        while  len(S2) > 0 and S2[-1][0] > j:
            a += S2[-1][1]
            S2.pop()
        S2.append([j,a])
print(A)

if len(S2)== 0:
    print(0)
else:
    print(len(S2),"",end="")
    for i in range(len(S2)):
        if i == len(S2) - 1:
            print(S2[i][1])
        else:
            print(S2[i][1],"",end="") from collections import deque x = input() x input() input A = 0 A 0 S1 = deque() S1 deque() deque S2 = deque() S2 deque() deque for i in range(len(x)):
    if x[i] == "\\":
        S1.append(i)
    elif x[i] == "/" and len(S1) > 0 :
        j = S1.pop()
        A += i - j
        a  = i - j
        while  len(S2) > 0 and S2[-1][0] > j:
            a += S2[-1][1]
            S2.pop()
        S2.append([j,a]) i range(len(x)) range len(x) len x if x[i] == "\\":
        S1.append(i)
    elif x[i] == "/" and len(S1) > 0 :
        j = S1.pop()
        A += i - j
        a  = i - j
        while  len(S2) > 0 and S2[-1][0] > j:
            a += S2[-1][1]
            S2.pop()
        S2.append([j,a]) x[i] == "\\" x[i] x i "\\" S1.append(i) S1.append S1 append i elif x[i] == "/" and len(S1) > 0 :
        j = S1.pop()
        A += i - j
        a  = i - j
        while  len(S2) > 0 and S2[-1][0] > j:
            a += S2[-1][1]
            S2.pop()
        S2.append([j,a]) x[i] == "/" and len(S1) > 0 x[i] == "/" x[i] x i "/" len(S1) > 0 len(S1) len S1 0 j = S1.pop() j S1.pop() S1.pop S1 pop A += i - j A i - j i j a  = i - j a i - j i j while  len(S2) > 0 and S2[-1][0] > j:
            a += S2[-1][1]
            S2.pop()
         len(S2) > 0 and S2[-1][0] > j len(S2) > 0 len(S2) len S2 0 S2[-1][0] > j S2[-1][0] [-1] S2 -1 0 j a += S2[-1][1] a S2[-1][1] [-1] S2 -1 1 S2.pop() S2.pop S2 pop S2.append([j,a]) S2.append S2 append [j,a] j a print(A) print A if len(S2)== 0:
    print(0)
else:
    print(len(S2),"",end="")
    for i in range(len(S2)):
        if i == len(S2) - 1:
            print(S2[i][1])
        else:
            print(S2[i][1],"",end="") len(S2)== 0 len(S2) len S2 0 print(0) print 0 print(len(S2),"",end="") print len(S2) len S2 "" end="" end "" for i in range(len(S2)):
        if i == len(S2) - 1:
            print(S2[i][1])
        else:
            print(S2[i][1],"",end="") i range(len(S2)) range len(S2) len S2 if i == len(S2) - 1:
            print(S2[i][1])
        else:
            print(S2[i][1],"",end="") i == len(S2) - 1 i len(S2) - 1 len(S2) len S2 1 print(S2[i][1]) print S2[i][1] [i] S2 i 1 print(S2[i][1],"",end="") print S2[i][1] [i] S2 i 1 "" end="" end "" S2 = deque() deque() S2 a += S2[-1][1] S2[-1][1] a A += i - j i - j A S1 = deque() deque() S1 j = S1.pop() S1.pop() j A = 0 0 A x = input() input() x a  = i - j i - j a
from collections import deque
x = input()
A = 0
S1 = deque()
S2 = deque()

for i in range(len(x)):
    if x[i] == "\\":
        S1.append(i)
    elif x[i] == "/" and len(S1) > 0 :
        j = S1.pop()
        A += i - j
        a  = i - j
        while  len(S2) > 0 and S2[-1][0] > j:
            a += S2[-1][1]
            S2.pop()
        S2.append([j,a])
print(A)

if len(S2)== 0:
    print(0)
else:
    print(len(S2),"",end="")
    for i in range(len(S2)):
        if i == len(S2) - 1:
            print(S2[i][1])
        else:
            print(S2[i][1],"",end="")
