import sys
from collections import deque

data = list(sys.stdin.readline()[:-1])

ponds = deque()
result = deque()
index = 0
amount = 0
lefs = deque()

for i in data:
    if i == "\\" or i == "_":
        ponds.append([i, index])
    else:
        count = 0
        while 1 <= len(ponds):
            pond, ind = ponds.pop()
            if pond == "\\":
                count += (index - ind)
                amount += count
                pre_pond = 0
                pre_left = 0
                while 0 < len(lefs) and ind < lefs[-1]:
                    pre_left = lefs.pop()
                    pre_pond += result.pop()
                lefs.append(ind)
                result.append(count + pre_pond)
                break
    index += 1

print(amount)
if 0 == len(result):
    print(0)
else:
    print(len(result), ' '.join(map(str, result))) import sys sys from collections import deque data = list(sys.stdin.readline()[:-1]) data list(sys.stdin.readline()[:-1]) list sys.stdin.readline()[:-1] sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline :-1 -1 ponds = deque() ponds deque() deque result = deque() result deque() deque index = 0 index 0 amount = 0 amount 0 lefs = deque() lefs deque() deque for i in data:
    if i == "\\" or i == "_":
        ponds.append([i, index])
    else:
        count = 0
        while 1 <= len(ponds):
            pond, ind = ponds.pop()
            if pond == "\\":
                count += (index - ind)
                amount += count
                pre_pond = 0
                pre_left = 0
                while 0 < len(lefs) and ind < lefs[-1]:
                    pre_left = lefs.pop()
                    pre_pond += result.pop()
                lefs.append(ind)
                result.append(count + pre_pond)
                break
    index += 1 i data if i == "\\" or i == "_":
        ponds.append([i, index])
    else:
        count = 0
        while 1 <= len(ponds):
            pond, ind = ponds.pop()
            if pond == "\\":
                count += (index - ind)
                amount += count
                pre_pond = 0
                pre_left = 0
                while 0 < len(lefs) and ind < lefs[-1]:
                    pre_left = lefs.pop()
                    pre_pond += result.pop()
                lefs.append(ind)
                result.append(count + pre_pond)
                break
     i == "\\" or i == "_" i == "\\" i "\\" i == "_" i "_" ponds.append([i, index]) ponds.append ponds append [i, index] i index count = 0 count 0 while 1 <= len(ponds):
            pond, ind = ponds.pop()
            if pond == "\\":
                count += (index - ind)
                amount += count
                pre_pond = 0
                pre_left = 0
                while 0 < len(lefs) and ind < lefs[-1]:
                    pre_left = lefs.pop()
                    pre_pond += result.pop()
                lefs.append(ind)
                result.append(count + pre_pond)
                break
     1 <= len(ponds) 1 len(ponds) len ponds pond, ind = ponds.pop() pond ponds.pop() ponds.pop ponds pop ind if pond == "\\":
                count += (index - ind)
                amount += count
                pre_pond = 0
                pre_left = 0
                while 0 < len(lefs) and ind < lefs[-1]:
                    pre_left = lefs.pop()
                    pre_pond += result.pop()
                lefs.append(ind)
                result.append(count + pre_pond)
                break
     pond == "\\" pond "\\" count += (index - ind) count index - ind index ind amount += count amount count pre_pond = 0 pre_pond 0 pre_left = 0 pre_left 0 while 0 < len(lefs) and ind < lefs[-1]:
                    pre_left = lefs.pop()
                    pre_pond += result.pop()
                 0 < len(lefs) and ind < lefs[-1] 0 < len(lefs) 0 len(lefs) len lefs ind < lefs[-1] ind lefs[-1] lefs -1 pre_left = lefs.pop() pre_left lefs.pop() lefs.pop lefs pop pre_pond += result.pop() pre_pond result.pop() result.pop result pop lefs.append(ind) lefs.append lefs append ind result.append(count + pre_pond) result.append result append count + pre_pond count pre_pond break index += 1 index 1 print(amount) print amount if 0 == len(result):
    print(0)
else:
    print(len(result), ' '.join(map(str, result))) 0 == len(result) 0 len(result) len result print(0) print 0 print(len(result), ' '.join(map(str, result))) print len(result) len result ' '.join(map(str, result)) ' '.join ' ' join map(str, result) map str result data = list(sys.stdin.readline()[:-1]) list(sys.stdin.readline()[:-1]) data lefs = deque() deque() lefs pre_left = lefs.pop() lefs.pop() pre_left pre_pond = 0 0 pre_pond index = 0 0 index pre_left = 0 0 pre_left pre_pond += result.pop() result.pop() pre_pond result = deque() deque() result amount = 0 0 amount pond, ind = ponds.pop() ponds.pop() pond index += 1 1 index ponds = deque() deque() ponds count += (index - ind) index - ind count amount += count count amount ind = ponds.pop() ponds.pop() ind count = 0 0 count
import sys
from collections import deque

data = list(sys.stdin.readline()[:-1])

ponds = deque()
result = deque()
index = 0
amount = 0
lefs = deque()

for i in data:
    if i == "\\" or i == "_":
        ponds.append([i, index])
    else:
        count = 0
        while 1 <= len(ponds):
            pond, ind = ponds.pop()
            if pond == "\\":
                count += (index - ind)
                amount += count
                pre_pond = 0
                pre_left = 0
                while 0 < len(lefs) and ind < lefs[-1]:
                    pre_left = lefs.pop()
                    pre_pond += result.pop()
                lefs.append(ind)
                result.append(count + pre_pond)
                break
    index += 1

print(amount)
if 0 == len(result):
    print(0)
else:
    print(len(result), ' '.join(map(str, result)))