s = j = 0
a, b, d = [], [], []

for i, x in enumerate(input()):
    if x == '\\':
        a += [i]
    elif x == '/' and a:
        j = a.pop()
        c = i-j
        s += c

        while b and b[-1] > j:
            c += d.pop()
            b.pop()

        b += [j]
        d += [c]

print(s)
print(len(b), *(d))
 s = j = 0 s 0 = j = 0 j 0 a, b, d = [], [], [] a [] b [] d [] for i, x in enumerate(input()):
    if x == '\\':
        a += [i]
    elif x == '/' and a:
        j = a.pop()
        c = i-j
        s += c

        while b and b[-1] > j:
            c += d.pop()
            b.pop()

        b += [j]
        d += [c] i x enumerate(input()) enumerate input() input if x == '\\':
        a += [i]
    elif x == '/' and a:
        j = a.pop()
        c = i-j
        s += c

        while b and b[-1] > j:
            c += d.pop()
            b.pop()

        b += [j]
        d += [c] x == '\\' x '\\' a += [i] a [i] i elif x == '/' and a:
        j = a.pop()
        c = i-j
        s += c

        while b and b[-1] > j:
            c += d.pop()
            b.pop()

        b += [j]
        d += [c] x == '/' and a x == '/' x '/' a j = a.pop() j a.pop() a.pop a pop c = i-j c i-j i j s += c s c while b and b[-1] > j:
            c += d.pop()
            b.pop()

         b and b[-1] > j b b[-1] > j b[-1] b -1 j c += d.pop() c d.pop() d.pop d pop b.pop() b.pop b pop b += [j] b [j] j d += [c] d [c] c print(s) print s print(len(b), *(d)) print len(b) len b *(d) d s += c c s j = 0 0 j d += [c] [c] d a, b, d = [], [], [] [] a d = [], [], [] [] d j = a.pop() a.pop() j b, d = [], [], [] [] b a += [i] [i] a c = i-j i-j c b += [j] [j] b s = j = 0 0 s c += d.pop() d.pop() c
s = j = 0
a, b, d = [], [], []

for i, x in enumerate(input()):
    if x == '\\':
        a += [i]
    elif x == '/' and a:
        j = a.pop()
        c = i-j
        s += c

        while b and b[-1] > j:
            c += d.pop()
            b.pop()

        b += [j]
        d += [c]

print(s)
print(len(b), *(d))

