from __future__ import print_function
from collections import deque

q = deque()
n = 0
d = 0
r = {}
mind = 0
maxd = 0

for x, c in enumerate(raw_input()):
    if c == "\\":
        d += 1
        maxd = max(maxd, d)
        q.append(x)
        n += 1
    elif c == "/":
        d -= 1
        mind = min(mind, d)
        if n == 0:
            continue
        x0 = q.pop()
        n -= 1
        s = x - x0
        if (d + 1) in r:
            while r[d + 1] and r[d + 1][-1][0] > x0:
                s += r[d + 1].pop()[1]
        if d not in r:
            r[d] = deque()
        r[d].append((x, s))

a = 0
k = 0
l = []
for d in xrange(mind, maxd):
    if d in r:
        for x, s in r[d]:
            a += s
            k += 1
            l.append((x, s))
l.sort()

print(a)
print(k, *(s for x, s in l)) from __future__ import print_function from collections import deque q = deque() q deque() deque n = 0 n 0 d = 0 d 0 r = {} r {} mind = 0 mind 0 maxd = 0 maxd 0 for x, c in enumerate(raw_input()):
    if c == "\\":
        d += 1
        maxd = max(maxd, d)
        q.append(x)
        n += 1
    elif c == "/":
        d -= 1
        mind = min(mind, d)
        if n == 0:
            continue
        x0 = q.pop()
        n -= 1
        s = x - x0
        if (d + 1) in r:
            while r[d + 1] and r[d + 1][-1][0] > x0:
                s += r[d + 1].pop()[1]
        if d not in r:
            r[d] = deque()
        r[d].append((x, s)) x c enumerate(raw_input()) enumerate raw_input() raw_input if c == "\\":
        d += 1
        maxd = max(maxd, d)
        q.append(x)
        n += 1
    elif c == "/":
        d -= 1
        mind = min(mind, d)
        if n == 0:
            continue
        x0 = q.pop()
        n -= 1
        s = x - x0
        if (d + 1) in r:
            while r[d + 1] and r[d + 1][-1][0] > x0:
                s += r[d + 1].pop()[1]
        if d not in r:
            r[d] = deque()
        r[d].append((x, s)) c == "\\" c "\\" d += 1 d 1 maxd = max(maxd, d) maxd max(maxd, d) max maxd d q.append(x) q.append q append x n += 1 n 1 elif c == "/":
        d -= 1
        mind = min(mind, d)
        if n == 0:
            continue
        x0 = q.pop()
        n -= 1
        s = x - x0
        if (d + 1) in r:
            while r[d + 1] and r[d + 1][-1][0] > x0:
                s += r[d + 1].pop()[1]
        if d not in r:
            r[d] = deque()
        r[d].append((x, s)) c == "/" c "/" d -= 1 d 1 mind = min(mind, d) mind min(mind, d) min mind d if n == 0:
            continue
         n == 0 n 0 continue x0 = q.pop() x0 q.pop() q.pop q pop n -= 1 n 1 s = x - x0 s x - x0 x x0 if (d + 1) in r:
            while r[d + 1] and r[d + 1][-1][0] > x0:
                s += r[d + 1].pop()[1]
         (d + 1) in r d + 1 d 1 r while r[d + 1] and r[d + 1][-1][0] > x0:
                s += r[d + 1].pop()[1]
         r[d + 1] and r[d + 1][-1][0] > x0 r[d + 1] r d + 1 d 1 r[d + 1][-1][0] > x0 r[d + 1][-1][0] [-1] [d + 1] r d + 1 d 1 -1 0 x0 s += r[d + 1].pop()[1] s r[d + 1].pop()[1] [d + 1].pop() [d + 1].pop [d + 1] r d + 1 d 1 pop 1 if d not in r:
            r[d] = deque()
         d not in r d r r[d] = deque() r[d] r d deque() deque r[d].append((x, s)) [d].append [d] r d append (x, s) x s a = 0 a 0 k = 0 k 0 l = [] l [] for d in xrange(mind, maxd):
    if d in r:
        for x, s in r[d]:
            a += s
            k += 1
            l.append((x, s)) d xrange(mind, maxd) xrange mind maxd if d in r:
        for x, s in r[d]:
            a += s
            k += 1
            l.append((x, s)) d in r d r for x, s in r[d]:
            a += s
            k += 1
            l.append((x, s)) x s r[d] r d a += s a s k += 1 k 1 l.append((x, s)) l.append l append (x, s) x s l.sort() l.sort l sort print(a) print a s for x, s in l for x, s in l x s l for x, s in l s print(k, *(s for x, s in l)) print k *(s for x, s in l) (s for x, s in l) d += 1 1 d maxd = max(maxd, d) max(maxd, d) maxd maxd = 0 0 maxd s += r[d + 1].pop()[1] r[d + 1].pop()[1] s n += 1 1 n d -= 1 1 d d = 0 0 d x0 = q.pop() q.pop() x0 n -= 1 1 n k += 1 1 k mind = 0 0 mind l = [] [] l a = 0 0 a n = 0 0 n k = 0 0 k a += s s a mind = min(mind, d) min(mind, d) mind q = deque() deque() q r = {} {} r s = x - x0 x - x0 s
from __future__ import print_function
from collections import deque

q = deque()
n = 0
d = 0
r = {}
mind = 0
maxd = 0

for x, c in enumerate(raw_input()):
    if c == "\\":
        d += 1
        maxd = max(maxd, d)
        q.append(x)
        n += 1
    elif c == "/":
        d -= 1
        mind = min(mind, d)
        if n == 0:
            continue
        x0 = q.pop()
        n -= 1
        s = x - x0
        if (d + 1) in r:
            while r[d + 1] and r[d + 1][-1][0] > x0:
                s += r[d + 1].pop()[1]
        if d not in r:
            r[d] = deque()
        r[d].append((x, s))

a = 0
k = 0
l = []
for d in xrange(mind, maxd):
    if d in r:
        for x, s in r[d]:
            a += s
            k += 1
            l.append((x, s))
l.sort()

print(a)
print(k, *(s for x, s in l))