from collections import deque
S = input()
d = deque()
d2 = deque()
r = []
r_l = 0
buf = 0
for i, s in enumerate(S):
    i += 1
    if s == '\\':
        d.append(i)
    elif s == '/' and len(d) > 0:
        k = d.pop()
        r_l += i - k
        buf = i - k
        while(len(d2) > 0 and d2[-1][0] > k):
            _d = d2.pop()
            buf += _d[1]
        l = [k, buf]
        d2.append(l)

r = []
for i in d2:
    r.append(i[1])
print(r_l)
print(len(r), *r)
 from collections import deque S = input() S input() input d = deque() d deque() deque d2 = deque() d2 deque() deque r = [] r [] r_l = 0 r_l 0 buf = 0 buf 0 for i, s in enumerate(S):
    i += 1
    if s == '\\':
        d.append(i)
    elif s == '/' and len(d) > 0:
        k = d.pop()
        r_l += i - k
        buf = i - k
        while(len(d2) > 0 and d2[-1][0] > k):
            _d = d2.pop()
            buf += _d[1]
        l = [k, buf]
        d2.append(l) i s enumerate(S) enumerate S i += 1 i 1 if s == '\\':
        d.append(i)
    elif s == '/' and len(d) > 0:
        k = d.pop()
        r_l += i - k
        buf = i - k
        while(len(d2) > 0 and d2[-1][0] > k):
            _d = d2.pop()
            buf += _d[1]
        l = [k, buf]
        d2.append(l) s == '\\' s '\\' d.append(i) d.append d append i elif s == '/' and len(d) > 0:
        k = d.pop()
        r_l += i - k
        buf = i - k
        while(len(d2) > 0 and d2[-1][0] > k):
            _d = d2.pop()
            buf += _d[1]
        l = [k, buf]
        d2.append(l) s == '/' and len(d) > 0 s == '/' s '/' len(d) > 0 len(d) len d 0 k = d.pop() k d.pop() d.pop d pop r_l += i - k r_l i - k i k buf = i - k buf i - k i k while(len(d2) > 0 and d2[-1][0] > k):
            _d = d2.pop()
            buf += _d[1]
         len(d2) > 0 and d2[-1][0] > k len(d2) > 0 len(d2) len d2 0 d2[-1][0] > k d2[-1][0] [-1] d2 -1 0 k _d = d2.pop() _d d2.pop() d2.pop d2 pop buf += _d[1] buf _d[1] _d 1 l = [k, buf] l [k, buf] k buf d2.append(l) d2.append d2 append l r = [] r [] for i in d2:
    r.append(i[1]) i d2 r.append(i[1]) r.append r append i[1] i 1 print(r_l) print r_l print(len(r), *r) print len(r) len r *r r i += 1 1 i r = [] [] r r = [] [] r r_l = 0 0 r_l buf += _d[1] _d[1] buf d2 = deque() deque() d2 buf = i - k i - k buf l = [k, buf] [k, buf] l r_l += i - k i - k r_l S = input() input() S buf = 0 0 buf _d = d2.pop() d2.pop() _d d = deque() deque() d k = d.pop() d.pop() k
from collections import deque
S = input()
d = deque()
d2 = deque()
r = []
r_l = 0
buf = 0
for i, s in enumerate(S):
    i += 1
    if s == '\\':
        d.append(i)
    elif s == '/' and len(d) > 0:
        k = d.pop()
        r_l += i - k
        buf = i - k
        while(len(d2) > 0 and d2[-1][0] > k):
            _d = d2.pop()
            buf += _d[1]
        l = [k, buf]
        d2.append(l)

r = []
for i in d2:
    r.append(i[1])
print(r_l)
print(len(r), *r)

