my_str = input()

s1 = []
s2 = []
sum = 0

for idx, letter in enumerate(my_str):
    if letter == '\\':
        s1.append(idx)

    elif letter == '/' and s1:
        jdx = s1.pop()
        a = idx -jdx
        sum += a

        while s2 and s2[-1][0] > jdx:
            a += s2.pop()[1]
        s2.append([jdx, a])

print(sum)
print(len(s2), *(a for _, a in s2)) my_str = input() my_str input() input s1 = [] s1 [] s2 = [] s2 [] sum = 0 sum 0 for idx, letter in enumerate(my_str):
    if letter == '\\':
        s1.append(idx)

    elif letter == '/' and s1:
        jdx = s1.pop()
        a = idx -jdx
        sum += a

        while s2 and s2[-1][0] > jdx:
            a += s2.pop()[1]
        s2.append([jdx, a]) idx letter enumerate(my_str) enumerate my_str if letter == '\\':
        s1.append(idx)

    elif letter == '/' and s1:
        jdx = s1.pop()
        a = idx -jdx
        sum += a

        while s2 and s2[-1][0] > jdx:
            a += s2.pop()[1]
        s2.append([jdx, a]) letter == '\\' letter '\\' s1.append(idx) s1.append s1 append idx elif letter == '/' and s1:
        jdx = s1.pop()
        a = idx -jdx
        sum += a

        while s2 and s2[-1][0] > jdx:
            a += s2.pop()[1]
        s2.append([jdx, a]) letter == '/' and s1 letter == '/' letter '/' s1 jdx = s1.pop() jdx s1.pop() s1.pop s1 pop a = idx -jdx a idx -jdx idx jdx sum += a sum a while s2 and s2[-1][0] > jdx:
            a += s2.pop()[1]
         s2 and s2[-1][0] > jdx s2 s2[-1][0] > jdx s2[-1][0] [-1] s2 -1 0 jdx a += s2.pop()[1] a s2.pop()[1] s2.pop() s2.pop s2 pop 1 s2.append([jdx, a]) s2.append s2 append [jdx, a] jdx a print(sum) print sum a for _, a in s2 for _, a in s2 _ a s2 for _, a in s2 a print(len(s2), *(a for _, a in s2)) print len(s2) len s2 *(a for _, a in s2) (a for _, a in s2) sum = 0 0 sum my_str = input() input() my_str s1 = [] [] s1 s2 = [] [] s2 jdx = s1.pop() s1.pop() jdx a += s2.pop()[1] s2.pop()[1] a a = idx -jdx idx -jdx a sum += a a sum
my_str = input()

s1 = []
s2 = []
sum = 0

for idx, letter in enumerate(my_str):
    if letter == '\\':
        s1.append(idx)

    elif letter == '/' and s1:
        jdx = s1.pop()
        a = idx -jdx
        sum += a

        while s2 and s2[-1][0] > jdx:
            a += s2.pop()[1]
        s2.append([jdx, a])

print(sum)
print(len(s2), *(a for _, a in s2))
