hoge1 = list()
hoge2 = list()
total = 0
for num, c in enumerate(input()):
    if c == '\\':
        hoge1.append(num)
    elif c == '/':
        if not hoge1:
            continue
        last_index = hoge1.pop()
        S = num - last_index
        if not hoge2:
            hoge2.append((last_index, S))
        else:
            if last_index >= hoge2[-1][0]:
                hoge2.append((last_index, S))
            else:
                new_S = S
                for i, j in hoge2[::-1]:
                    if last_index >= i:
                        break
                    else:
                        new_S += hoge2.pop()[1] 
                hoge2.append((last_index, new_S))

totals = [x[1] for x in hoge2]
print (sum(totals))
totals.insert(0, len(hoge2))
print (' '.join([str(x) for x in totals])) hoge1 = list() hoge1 list() list hoge2 = list() hoge2 list() list total = 0 total 0 for num, c in enumerate(input()):
    if c == '\\':
        hoge1.append(num)
    elif c == '/':
        if not hoge1:
            continue
        last_index = hoge1.pop()
        S = num - last_index
        if not hoge2:
            hoge2.append((last_index, S))
        else:
            if last_index >= hoge2[-1][0]:
                hoge2.append((last_index, S))
            else:
                new_S = S
                for i, j in hoge2[::-1]:
                    if last_index >= i:
                        break
                    else:
                        new_S += hoge2.pop()[1] 
                hoge2.append((last_index, new_S)) num c enumerate(input()) enumerate input() input if c == '\\':
        hoge1.append(num)
    elif c == '/':
        if not hoge1:
            continue
        last_index = hoge1.pop()
        S = num - last_index
        if not hoge2:
            hoge2.append((last_index, S))
        else:
            if last_index >= hoge2[-1][0]:
                hoge2.append((last_index, S))
            else:
                new_S = S
                for i, j in hoge2[::-1]:
                    if last_index >= i:
                        break
                    else:
                        new_S += hoge2.pop()[1] 
                hoge2.append((last_index, new_S)) c == '\\' c '\\' hoge1.append(num) hoge1.append hoge1 append num elif c == '/':
        if not hoge1:
            continue
        last_index = hoge1.pop()
        S = num - last_index
        if not hoge2:
            hoge2.append((last_index, S))
        else:
            if last_index >= hoge2[-1][0]:
                hoge2.append((last_index, S))
            else:
                new_S = S
                for i, j in hoge2[::-1]:
                    if last_index >= i:
                        break
                    else:
                        new_S += hoge2.pop()[1] 
                hoge2.append((last_index, new_S)) c == '/' c '/' if not hoge1:
            continue
         not hoge1 hoge1 continue last_index = hoge1.pop() last_index hoge1.pop() hoge1.pop hoge1 pop S = num - last_index S num - last_index num last_index if not hoge2:
            hoge2.append((last_index, S))
        else:
            if last_index >= hoge2[-1][0]:
                hoge2.append((last_index, S))
            else:
                new_S = S
                for i, j in hoge2[::-1]:
                    if last_index >= i:
                        break
                    else:
                        new_S += hoge2.pop()[1] 
                hoge2.append((last_index, new_S)) not hoge2 hoge2 hoge2.append((last_index, S)) hoge2.append hoge2 append (last_index, S) last_index S if last_index >= hoge2[-1][0]:
                hoge2.append((last_index, S))
            else:
                new_S = S
                for i, j in hoge2[::-1]:
                    if last_index >= i:
                        break
                    else:
                        new_S += hoge2.pop()[1] 
                hoge2.append((last_index, new_S)) last_index >= hoge2[-1][0] last_index hoge2[-1][0] [-1] hoge2 -1 0 hoge2.append((last_index, S)) hoge2.append hoge2 append (last_index, S) last_index S new_S = S new_S S for i, j in hoge2[::-1]:
                    if last_index >= i:
                        break
                    else:
                        new_S += hoge2.pop()[1] 
                 i j hoge2[::-1] hoge2 ::-1 -1 if last_index >= i:
                        break
                    else:
                        new_S += hoge2.pop()[1] 
                 last_index >= i last_index i break new_S += hoge2.pop()[1] new_S hoge2.pop()[1] hoge2.pop() hoge2.pop hoge2 pop 1 hoge2.append((last_index, new_S)) hoge2.append hoge2 append (last_index, new_S) last_index new_S x[1] for x in hoge2 for x in hoge2 x hoge2 for x in hoge2 x[1] x 1 totals = [x[1] for x in hoge2] totals [x[1] for x in hoge2] print (sum(totals)) print sum(totals) sum totals totals.insert(0, len(hoge2)) totals.insert totals insert 0 len(hoge2) len hoge2 str(x) for x in totals for x in totals x totals for x in totals str(x) str x print (' '.join([str(x) for x in totals])) print ' '.join([str(x) for x in totals]) ' '.join ' ' join [str(x) for x in totals] new_S += hoge2.pop()[1] hoge2.pop()[1] new_S last_index = hoge1.pop() hoge1.pop() last_index S = num - last_index num - last_index S hoge2 = list() list() hoge2 hoge1 = list() list() hoge1 total = 0 0 total new_S = S S new_S totals = [x[1] for x in hoge2] [x[1] for x in hoge2] totals
hoge1 = list()
hoge2 = list()
total = 0
for num, c in enumerate(input()):
    if c == '\\':
        hoge1.append(num)
    elif c == '/':
        if not hoge1:
            continue
        last_index = hoge1.pop()
        S = num - last_index
        if not hoge2:
            hoge2.append((last_index, S))
        else:
            if last_index >= hoge2[-1][0]:
                hoge2.append((last_index, S))
            else:
                new_S = S
                for i, j in hoge2[::-1]:
                    if last_index >= i:
                        break
                    else:
                        new_S += hoge2.pop()[1] 
                hoge2.append((last_index, new_S))

totals = [x[1] for x in hoge2]
print (sum(totals))
totals.insert(0, len(hoge2))
print (' '.join([str(x) for x in totals]))
