s = input()
a = []
down = []
a_sum = 0
for i,line in enumerate(s):
    if line == "\\":
        down.append(i)
    elif line == "/" and down:
        j = down.pop()
        a_tmp = i-j
        a_sum += a_tmp
        while a and a[-1][0] > j:
            a_tmp += a.pop()[1]
        a.append([j,a_tmp])

print(a_sum)
print(len(a),*[s for i,s in a]) s = input() s input() input a = [] a [] down = [] down [] a_sum = 0 a_sum 0 for i,line in enumerate(s):
    if line == "\\":
        down.append(i)
    elif line == "/" and down:
        j = down.pop()
        a_tmp = i-j
        a_sum += a_tmp
        while a and a[-1][0] > j:
            a_tmp += a.pop()[1]
        a.append([j,a_tmp]) i line enumerate(s) enumerate s if line == "\\":
        down.append(i)
    elif line == "/" and down:
        j = down.pop()
        a_tmp = i-j
        a_sum += a_tmp
        while a and a[-1][0] > j:
            a_tmp += a.pop()[1]
        a.append([j,a_tmp]) line == "\\" line "\\" down.append(i) down.append down append i elif line == "/" and down:
        j = down.pop()
        a_tmp = i-j
        a_sum += a_tmp
        while a and a[-1][0] > j:
            a_tmp += a.pop()[1]
        a.append([j,a_tmp]) line == "/" and down line == "/" line "/" down j = down.pop() j down.pop() down.pop down pop a_tmp = i-j a_tmp i-j i j a_sum += a_tmp a_sum a_tmp while a and a[-1][0] > j:
            a_tmp += a.pop()[1]
         a and a[-1][0] > j a a[-1][0] > j a[-1][0] [-1] a -1 0 j a_tmp += a.pop()[1] a_tmp a.pop()[1] a.pop() a.pop a pop 1 a.append([j,a_tmp]) a.append a append [j,a_tmp] j a_tmp print(a_sum) print a_sum s for i,s in a for i,s in a i s a for i,s in a s print(len(a),*[s for i,s in a]) print len(a) len a *[s for i,s in a] [s for i,s in a] s = input() input() s a = [] [] a a_sum = 0 0 a_sum a_tmp = i-j i-j a_tmp a_tmp += a.pop()[1] a.pop()[1] a_tmp down = [] [] down a_sum += a_tmp a_tmp a_sum j = down.pop() down.pop() j
s = input()
a = []
down = []
a_sum = 0
for i,line in enumerate(s):
    if line == "\\":
        down.append(i)
    elif line == "/" and down:
        j = down.pop()
        a_tmp = i-j
        a_sum += a_tmp
        while a and a[-1][0] > j:
            a_tmp += a.pop()[1]
        a.append([j,a_tmp])

print(a_sum)
print(len(a),*[s for i,s in a])