lines = input()
stack_1 = []
stack_2 = []

area = 0
for i, line in enumerate(lines):
    if line == '\\':
        stack_1.append(i)
    elif line == '_':
        pass
    elif line == '/':
        if stack_1 == []:
            continue
        last_index = stack_1.pop()
        this_area = i - last_index
        area += this_area

        if stack_2 == []:
            stack_2.append((last_index, this_area))
            continue

        block_area = this_area
        while True:
            if stack_2 == []:
                break
            stack_2_index, stack_2_area = stack_2.pop()
            if stack_2_index < last_index:
                stack_2.append((stack_2_index, stack_2_area))
                break
            else:
                block_area += stack_2_area
        stack_2.append((last_index, block_area))

print(area)
kazu = len(stack_2)
kaku_menseki = [stack_2[i][1] for i in range(len(stack_2))]
kaku_menseki_out = ' '.join(map(str, kaku_menseki))
if kazu > 0:
    print(f'{kazu} {kaku_menseki_out}')
else:
    print(f'{kazu}')
 lines = input() lines input() input stack_1 = [] stack_1 [] stack_2 = [] stack_2 [] area = 0 area 0 for i, line in enumerate(lines):
    if line == '\\':
        stack_1.append(i)
    elif line == '_':
        pass
    elif line == '/':
        if stack_1 == []:
            continue
        last_index = stack_1.pop()
        this_area = i - last_index
        area += this_area

        if stack_2 == []:
            stack_2.append((last_index, this_area))
            continue

        block_area = this_area
        while True:
            if stack_2 == []:
                break
            stack_2_index, stack_2_area = stack_2.pop()
            if stack_2_index < last_index:
                stack_2.append((stack_2_index, stack_2_area))
                break
            else:
                block_area += stack_2_area
        stack_2.append((last_index, block_area)) i line enumerate(lines) enumerate lines if line == '\\':
        stack_1.append(i)
    elif line == '_':
        pass
    elif line == '/':
        if stack_1 == []:
            continue
        last_index = stack_1.pop()
        this_area = i - last_index
        area += this_area

        if stack_2 == []:
            stack_2.append((last_index, this_area))
            continue

        block_area = this_area
        while True:
            if stack_2 == []:
                break
            stack_2_index, stack_2_area = stack_2.pop()
            if stack_2_index < last_index:
                stack_2.append((stack_2_index, stack_2_area))
                break
            else:
                block_area += stack_2_area
        stack_2.append((last_index, block_area)) line == '\\' line '\\' stack_1.append(i) stack_1.append stack_1 append i elif line == '_':
        pass
     line == '_' line '_' elif line == '/':
        if stack_1 == []:
            continue
        last_index = stack_1.pop()
        this_area = i - last_index
        area += this_area

        if stack_2 == []:
            stack_2.append((last_index, this_area))
            continue

        block_area = this_area
        while True:
            if stack_2 == []:
                break
            stack_2_index, stack_2_area = stack_2.pop()
            if stack_2_index < last_index:
                stack_2.append((stack_2_index, stack_2_area))
                break
            else:
                block_area += stack_2_area
        stack_2.append((last_index, block_area)) line == '/' line '/' if stack_1 == []:
            continue
         stack_1 == [] stack_1 [] continue last_index = stack_1.pop() last_index stack_1.pop() stack_1.pop stack_1 pop this_area = i - last_index this_area i - last_index i last_index area += this_area area this_area if stack_2 == []:
            stack_2.append((last_index, this_area))
            continue

         stack_2 == [] stack_2 [] stack_2.append((last_index, this_area)) stack_2.append stack_2 append (last_index, this_area) last_index this_area continue block_area = this_area block_area this_area while True:
            if stack_2 == []:
                break
            stack_2_index, stack_2_area = stack_2.pop()
            if stack_2_index < last_index:
                stack_2.append((stack_2_index, stack_2_area))
                break
            else:
                block_area += stack_2_area
         True if stack_2 == []:
                break
             stack_2 == [] stack_2 [] break stack_2_index, stack_2_area = stack_2.pop() stack_2_index stack_2.pop() stack_2.pop stack_2 pop stack_2_area if stack_2_index < last_index:
                stack_2.append((stack_2_index, stack_2_area))
                break
            else:
                block_area += stack_2_area
         stack_2_index < last_index stack_2_index last_index stack_2.append((stack_2_index, stack_2_area)) stack_2.append stack_2 append (stack_2_index, stack_2_area) stack_2_index stack_2_area break block_area += stack_2_area block_area stack_2_area stack_2.append((last_index, block_area)) stack_2.append stack_2 append (last_index, block_area) last_index block_area print(area) print area kazu = len(stack_2) kazu len(stack_2) len stack_2 stack_2[i][1] for i in range(len(stack_2)) for i in range(len(stack_2)) i range(len(stack_2)) range len(stack_2) len stack_2 for i in range(len(stack_2)) stack_2[i][1] [i] stack_2 i 1 kaku_menseki = [stack_2[i][1] for i in range(len(stack_2))] kaku_menseki [stack_2[i][1] for i in range(len(stack_2))] kaku_menseki_out = ' '.join(map(str, kaku_menseki)) kaku_menseki_out ' '.join(map(str, kaku_menseki)) ' '.join ' ' join map(str, kaku_menseki) map str kaku_menseki if kazu > 0:
    print(f'{kazu} {kaku_menseki_out}')
else:
    print(f'{kazu}') kazu > 0 kazu 0 print(f'{kazu} {kaku_menseki_out}') print f'{kazu} {kaku_menseki_out}' print(f'{kazu}') print f'{kazu}' stack_2_area = stack_2.pop() stack_2.pop() stack_2_area lines = input() input() lines kaku_menseki = [stack_2[i][1] for i in range(len(stack_2))] [stack_2[i][1] for i in range(len(stack_2))] kaku_menseki this_area = i - last_index i - last_index this_area block_area += stack_2_area stack_2_area block_area block_area = this_area this_area block_area area += this_area this_area area stack_2_index, stack_2_area = stack_2.pop() stack_2.pop() stack_2_index kaku_menseki_out = ' '.join(map(str, kaku_menseki)) ' '.join(map(str, kaku_menseki)) kaku_menseki_out area = 0 0 area kazu = len(stack_2) len(stack_2) kazu stack_1 = [] [] stack_1 stack_2 = [] [] stack_2 last_index = stack_1.pop() stack_1.pop() last_index
lines = input()
stack_1 = []
stack_2 = []

area = 0
for i, line in enumerate(lines):
    if line == '\\':
        stack_1.append(i)
    elif line == '_':
        pass
    elif line == '/':
        if stack_1 == []:
            continue
        last_index = stack_1.pop()
        this_area = i - last_index
        area += this_area

        if stack_2 == []:
            stack_2.append((last_index, this_area))
            continue

        block_area = this_area
        while True:
            if stack_2 == []:
                break
            stack_2_index, stack_2_area = stack_2.pop()
            if stack_2_index < last_index:
                stack_2.append((stack_2_index, stack_2_area))
                break
            else:
                block_area += stack_2_area
        stack_2.append((last_index, block_area))

print(area)
kazu = len(stack_2)
kaku_menseki = [stack_2[i][1] for i in range(len(stack_2))]
kaku_menseki_out = ' '.join(map(str, kaku_menseki))
if kazu > 0:
    print(f'{kazu} {kaku_menseki_out}')
else:
    print(f'{kazu}')

