from collections import deque
import sys
input = sys.stdin.readline

def putsarray(array):
    if len(array) == 0:
        print()
        return
    for i in range(len(array) - 1):
        print(int(array[i]), end=' ')
    print(int(array[-1]))

def main():
    stack = deque([])
    instr = input()
    is_same_lake = False
    result = 0

    lakes = deque([])

    for i in range(len(instr)):
        char = instr[i]
        if char == "\\":
            stack.append(i)
        elif char == "_":
            pass
        elif char == "/":
            if len(stack) == 0:
                is_same_lake = False
                continue
            down = stack.pop()
            result += i - down
            lake_area = i - down
            index = len(lakes) -1
            while True:
                if index < 0:
                    break
                lake = lakes[index]
                if down < lake[0] and lake[1] < i:
                    lake_area += lakes.pop()[2]
                else:
                    break
                index -= 1
                    
            lakes.append((down, i, lake_area))

    print(int(result))
    putsarray([len(lakes),] + [l[2] for l in lakes])

    

main()



 from collections import deque import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline def putsarray(array):
    if len(array) == 0:
        print()
        return
    for i in range(len(array) - 1):
        print(int(array[i]), end=' ')
    print(int(array[-1])) putsarray if len(array) == 0:
        print()
        return
     len(array) == 0 len(array) len array 0 print() print return for i in range(len(array) - 1):
        print(int(array[i]), end=' ')
     i range(len(array) - 1) range len(array) - 1 len(array) len array 1 print(int(array[i]), end=' ') print int(array[i]) int array[i] array i end=' ' end ' ' print(int(array[-1])) print int(array[-1]) int array[-1] array -1 array array def main():
    stack = deque([])
    instr = input()
    is_same_lake = False
    result = 0

    lakes = deque([])

    for i in range(len(instr)):
        char = instr[i]
        if char == "\\":
            stack.append(i)
        elif char == "_":
            pass
        elif char == "/":
            if len(stack) == 0:
                is_same_lake = False
                continue
            down = stack.pop()
            result += i - down
            lake_area = i - down
            index = len(lakes) -1
            while True:
                if index < 0:
                    break
                lake = lakes[index]
                if down < lake[0] and lake[1] < i:
                    lake_area += lakes.pop()[2]
                else:
                    break
                index -= 1
                    
            lakes.append((down, i, lake_area))

    print(int(result))
    putsarray([len(lakes),] + [l[2] for l in lakes])

     main stack = deque([]) stack deque([]) deque [] instr = input() instr input() input is_same_lake = False is_same_lake False result = 0 result 0 lakes = deque([]) lakes deque([]) deque [] for i in range(len(instr)):
        char = instr[i]
        if char == "\\":
            stack.append(i)
        elif char == "_":
            pass
        elif char == "/":
            if len(stack) == 0:
                is_same_lake = False
                continue
            down = stack.pop()
            result += i - down
            lake_area = i - down
            index = len(lakes) -1
            while True:
                if index < 0:
                    break
                lake = lakes[index]
                if down < lake[0] and lake[1] < i:
                    lake_area += lakes.pop()[2]
                else:
                    break
                index -= 1
                    
            lakes.append((down, i, lake_area))

     i range(len(instr)) range len(instr) len instr char = instr[i] char instr[i] instr i if char == "\\":
            stack.append(i)
        elif char == "_":
            pass
        elif char == "/":
            if len(stack) == 0:
                is_same_lake = False
                continue
            down = stack.pop()
            result += i - down
            lake_area = i - down
            index = len(lakes) -1
            while True:
                if index < 0:
                    break
                lake = lakes[index]
                if down < lake[0] and lake[1] < i:
                    lake_area += lakes.pop()[2]
                else:
                    break
                index -= 1
                    
            lakes.append((down, i, lake_area))

     char == "\\" char "\\" stack.append(i) stack.append stack append i elif char == "_":
            pass
         char == "_" char "_" elif char == "/":
            if len(stack) == 0:
                is_same_lake = False
                continue
            down = stack.pop()
            result += i - down
            lake_area = i - down
            index = len(lakes) -1
            while True:
                if index < 0:
                    break
                lake = lakes[index]
                if down < lake[0] and lake[1] < i:
                    lake_area += lakes.pop()[2]
                else:
                    break
                index -= 1
                    
            lakes.append((down, i, lake_area))

     char == "/" char "/" if len(stack) == 0:
                is_same_lake = False
                continue
             len(stack) == 0 len(stack) len stack 0 is_same_lake = False is_same_lake False continue down = stack.pop() down stack.pop() stack.pop stack pop result += i - down result i - down i down lake_area = i - down lake_area i - down i down index = len(lakes) -1 index len(lakes) -1 len(lakes) len lakes 1 while True:
                if index < 0:
                    break
                lake = lakes[index]
                if down < lake[0] and lake[1] < i:
                    lake_area += lakes.pop()[2]
                else:
                    break
                index -= 1
                    
             True if index < 0:
                    break
                 index < 0 index 0 break lake = lakes[index] lake lakes[index] lakes index if down < lake[0] and lake[1] < i:
                    lake_area += lakes.pop()[2]
                else:
                    break
                 down < lake[0] and lake[1] < i down < lake[0] down lake[0] lake 0 lake[1] < i lake[1] lake 1 i lake_area += lakes.pop()[2] lake_area lakes.pop()[2] lakes.pop() lakes.pop lakes pop 2 break index -= 1 index 1 lakes.append((down, i, lake_area)) lakes.append lakes append (down, i, lake_area) down i lake_area print(int(result)) print int(result) int result l[2] for l in lakes for l in lakes l lakes for l in lakes l[2] l 2 putsarray([len(lakes),] + [l[2] for l in lakes]) putsarray [len(lakes),] + [l[2] for l in lakes] [len(lakes),] len(lakes) len lakes [l[2] for l in lakes] main() main input = sys.stdin.readline sys.stdin.readline input def putsarray(array):
    if len(array) == 0:
        print()
        return
    for i in range(len(array) - 1):
        print(int(array[i]), end=' ')
    print(int(array[-1])) def putsarray(array):
    if len(array) == 0:
        print()
        return
    for i in range(len(array) - 1):
        print(int(array[i]), end=' ')
    print(int(array[-1])) putsarray def main():
    stack = deque([])
    instr = input()
    is_same_lake = False
    result = 0

    lakes = deque([])

    for i in range(len(instr)):
        char = instr[i]
        if char == "\\":
            stack.append(i)
        elif char == "_":
            pass
        elif char == "/":
            if len(stack) == 0:
                is_same_lake = False
                continue
            down = stack.pop()
            result += i - down
            lake_area = i - down
            index = len(lakes) -1
            while True:
                if index < 0:
                    break
                lake = lakes[index]
                if down < lake[0] and lake[1] < i:
                    lake_area += lakes.pop()[2]
                else:
                    break
                index -= 1
                    
            lakes.append((down, i, lake_area))

    print(int(result))
    putsarray([len(lakes),] + [l[2] for l in lakes])

     def main():
    stack = deque([])
    instr = input()
    is_same_lake = False
    result = 0

    lakes = deque([])

    for i in range(len(instr)):
        char = instr[i]
        if char == "\\":
            stack.append(i)
        elif char == "_":
            pass
        elif char == "/":
            if len(stack) == 0:
                is_same_lake = False
                continue
            down = stack.pop()
            result += i - down
            lake_area = i - down
            index = len(lakes) -1
            while True:
                if index < 0:
                    break
                lake = lakes[index]
                if down < lake[0] and lake[1] < i:
                    lake_area += lakes.pop()[2]
                else:
                    break
                index -= 1
                    
            lakes.append((down, i, lake_area))

    print(int(result))
    putsarray([len(lakes),] + [l[2] for l in lakes])

     main
from collections import deque
import sys
input = sys.stdin.readline

def putsarray(array):
    if len(array) == 0:
        print()
        return
    for i in range(len(array) - 1):
        print(int(array[i]), end=' ')
    print(int(array[-1]))

def main():
    stack = deque([])
    instr = input()
    is_same_lake = False
    result = 0

    lakes = deque([])

    for i in range(len(instr)):
        char = instr[i]
        if char == "\\":
            stack.append(i)
        elif char == "_":
            pass
        elif char == "/":
            if len(stack) == 0:
                is_same_lake = False
                continue
            down = stack.pop()
            result += i - down
            lake_area = i - down
            index = len(lakes) -1
            while True:
                if index < 0:
                    break
                lake = lakes[index]
                if down < lake[0] and lake[1] < i:
                    lake_area += lakes.pop()[2]
                else:
                    break
                index -= 1
                    
            lakes.append((down, i, lake_area))

    print(int(result))
    putsarray([len(lakes),] + [l[2] for l in lakes])

    

main()




