lines = list(input())
total = 0
size = 0

stack = []
ponds = []
size = 0
for i in range(len(lines)):
    if lines[i] == "\\":
        stack.append(i)
    elif lines[i] == "/":
        if not stack == []:
            left_index = stack.pop()
            size = i - left_index
            target_index = left_index
            
            #order is tricky
            while not ponds == [] and ponds[-1][0] > left_index:
                direct = ponds.pop()
                target_index = direct[0]
                size += direct[1]
            ponds.append([target_index,size])




ans = []
ans.append(len(ponds))
for _ in ponds:
    ans.append(_[1])

print(sum(ans[1:]))
print(" ".join(map(str,ans))) lines = list(input()) lines list(input()) list input() input total = 0 total 0 size = 0 size 0 stack = [] stack [] ponds = [] ponds [] size = 0 size 0 for i in range(len(lines)):
    if lines[i] == "\\":
        stack.append(i)
    elif lines[i] == "/":
        if not stack == []:
            left_index = stack.pop()
            size = i - left_index
            target_index = left_index
            
            #order is tricky
            while not ponds == [] and ponds[-1][0] > left_index:
                direct = ponds.pop()
                target_index = direct[0]
                size += direct[1]
            ponds.append([target_index,size]) i range(len(lines)) range len(lines) len lines if lines[i] == "\\":
        stack.append(i)
    elif lines[i] == "/":
        if not stack == []:
            left_index = stack.pop()
            size = i - left_index
            target_index = left_index
            
            #order is tricky
            while not ponds == [] and ponds[-1][0] > left_index:
                direct = ponds.pop()
                target_index = direct[0]
                size += direct[1]
            ponds.append([target_index,size]) lines[i] == "\\" lines[i] lines i "\\" stack.append(i) stack.append stack append i elif lines[i] == "/":
        if not stack == []:
            left_index = stack.pop()
            size = i - left_index
            target_index = left_index
            
            #order is tricky
            while not ponds == [] and ponds[-1][0] > left_index:
                direct = ponds.pop()
                target_index = direct[0]
                size += direct[1]
            ponds.append([target_index,size]) lines[i] == "/" lines[i] lines i "/" if not stack == []:
            left_index = stack.pop()
            size = i - left_index
            target_index = left_index
            
            #order is tricky
            while not ponds == [] and ponds[-1][0] > left_index:
                direct = ponds.pop()
                target_index = direct[0]
                size += direct[1]
            ponds.append([target_index,size]) not stack == [] stack == [] stack [] left_index = stack.pop() left_index stack.pop() stack.pop stack pop size = i - left_index size i - left_index i left_index target_index = left_index target_index left_index while not ponds == [] and ponds[-1][0] > left_index:
                direct = ponds.pop()
                target_index = direct[0]
                size += direct[1]
             not ponds == [] and ponds[-1][0] > left_index not ponds == [] ponds == [] ponds [] ponds[-1][0] > left_index ponds[-1][0] [-1] ponds -1 0 left_index direct = ponds.pop() direct ponds.pop() ponds.pop ponds pop target_index = direct[0] target_index direct[0] direct 0 size += direct[1] size direct[1] direct 1 ponds.append([target_index,size]) ponds.append ponds append [target_index,size] target_index size ans = [] ans [] ans.append(len(ponds)) ans.append ans append len(ponds) len ponds for _ in ponds:
    ans.append(_[1]) _ ponds ans.append(_[1]) ans.append ans append _[1] _ 1 print(sum(ans[1:])) print sum(ans[1:]) sum ans[1:] ans 1: 1 print(" ".join(map(str,ans))) print " ".join(map(str,ans)) " ".join " " join map(str,ans) map str ans left_index = stack.pop() stack.pop() left_index target_index = direct[0] direct[0] target_index stack = [] [] stack size = i - left_index i - left_index size direct = ponds.pop() ponds.pop() direct lines = list(input()) list(input()) lines size += direct[1] direct[1] size ponds = [] [] ponds ans = [] [] ans size = 0 0 size total = 0 0 total target_index = left_index left_index target_index size = 0 0 size
lines = list(input())
total = 0
size = 0

stack = []
ponds = []
size = 0
for i in range(len(lines)):
    if lines[i] == "\\":
        stack.append(i)
    elif lines[i] == "/":
        if not stack == []:
            left_index = stack.pop()
            size = i - left_index
            target_index = left_index
            
            #order is tricky
            while not ponds == [] and ponds[-1][0] > left_index:
                direct = ponds.pop()
                target_index = direct[0]
                size += direct[1]
            ponds.append([target_index,size])




ans = []
ans.append(len(ponds))
for _ in ponds:
    ans.append(_[1])

print(sum(ans[1:]))
print(" ".join(map(str,ans)))
