stack = []
res = []

area = input()

for i, terrain in enumerate(area):
    if terrain == '\\':
        stack.append(i)
    elif terrain == '/' and len(stack)>0:
        left = stack.pop()
        pond = i - left
        if len(res) == 0 or left >= res[-1][0]:
            res.append([left,pond])
        else:
            while len(res) > 0 and left < res[-1][0] :
                pond += res[-1][1]
                res.pop()
            res.append([left,pond])

total = 0
ponds = []
for i in res:
    ponds.append(i[1])
    total += i[1]

ans = [len(res)]
ans += ponds
ans_new = " ".join(map(str,ans))

print(total)
print(ans_new)
 stack = [] stack [] res = [] res [] area = input() area input() input for i, terrain in enumerate(area):
    if terrain == '\\':
        stack.append(i)
    elif terrain == '/' and len(stack)>0:
        left = stack.pop()
        pond = i - left
        if len(res) == 0 or left >= res[-1][0]:
            res.append([left,pond])
        else:
            while len(res) > 0 and left < res[-1][0] :
                pond += res[-1][1]
                res.pop()
            res.append([left,pond]) i terrain enumerate(area) enumerate area if terrain == '\\':
        stack.append(i)
    elif terrain == '/' and len(stack)>0:
        left = stack.pop()
        pond = i - left
        if len(res) == 0 or left >= res[-1][0]:
            res.append([left,pond])
        else:
            while len(res) > 0 and left < res[-1][0] :
                pond += res[-1][1]
                res.pop()
            res.append([left,pond]) terrain == '\\' terrain '\\' stack.append(i) stack.append stack append i elif terrain == '/' and len(stack)>0:
        left = stack.pop()
        pond = i - left
        if len(res) == 0 or left >= res[-1][0]:
            res.append([left,pond])
        else:
            while len(res) > 0 and left < res[-1][0] :
                pond += res[-1][1]
                res.pop()
            res.append([left,pond]) terrain == '/' and len(stack)>0 terrain == '/' terrain '/' len(stack)>0 len(stack) len stack 0 left = stack.pop() left stack.pop() stack.pop stack pop pond = i - left pond i - left i left if len(res) == 0 or left >= res[-1][0]:
            res.append([left,pond])
        else:
            while len(res) > 0 and left < res[-1][0] :
                pond += res[-1][1]
                res.pop()
            res.append([left,pond]) len(res) == 0 or left >= res[-1][0] len(res) == 0 len(res) len res 0 left >= res[-1][0] left res[-1][0] [-1] res -1 0 res.append([left,pond]) res.append res append [left,pond] left pond while len(res) > 0 and left < res[-1][0] :
                pond += res[-1][1]
                res.pop()
             len(res) > 0 and left < res[-1][0] len(res) > 0 len(res) len res 0 left < res[-1][0] left res[-1][0] [-1] res -1 0 pond += res[-1][1] pond res[-1][1] [-1] res -1 1 res.pop() res.pop res pop res.append([left,pond]) res.append res append [left,pond] left pond total = 0 total 0 ponds = [] ponds [] for i in res:
    ponds.append(i[1])
    total += i[1] i res ponds.append(i[1]) ponds.append ponds append i[1] i 1 total += i[1] total i[1] i 1 ans = [len(res)] ans [len(res)] len(res) len res ans += ponds ans ponds ans_new = " ".join(map(str,ans)) ans_new " ".join(map(str,ans)) " ".join " " join map(str,ans) map str ans print(total) print total print(ans_new) print ans_new area = input() input() area total = 0 0 total res = [] [] res pond = i - left i - left pond ponds = [] [] ponds stack = [] [] stack left = stack.pop() stack.pop() left pond += res[-1][1] res[-1][1] pond ans_new = " ".join(map(str,ans)) " ".join(map(str,ans)) ans_new ans = [len(res)] [len(res)] ans ans += ponds ponds ans total += i[1] i[1] total
stack = []
res = []

area = input()

for i, terrain in enumerate(area):
    if terrain == '\\':
        stack.append(i)
    elif terrain == '/' and len(stack)>0:
        left = stack.pop()
        pond = i - left
        if len(res) == 0 or left >= res[-1][0]:
            res.append([left,pond])
        else:
            while len(res) > 0 and left < res[-1][0] :
                pond += res[-1][1]
                res.pop()
            res.append([left,pond])

total = 0
ponds = []
for i in res:
    ponds.append(i[1])
    total += i[1]

ans = [len(res)]
ans += ponds
ans_new = " ".join(map(str,ans))

print(total)
print(ans_new)

