from collections import deque


def main():
    stack = deque()
    diagram = input()
    square = []

    for index, value in enumerate(diagram):
        if value == '\\':
            stack.append(-index)
        elif value == '/':
            if len(stack) > 0:
                tmp = []
                while True:
                    tmp.append(stack.pop())
                    if tmp[-1] <= 0:
                        stack.append(sum(tmp[:-1]) + index + tmp[-1])
                        break
                if len(stack) == 1:
                    square.append(stack.pop())
    square.extend([i for i in stack if i > 0])

    print(sum(square))
    if sum(square) == 0:
        print(0)
    else:
        print('{} {}'.format(len(square), ' '.join([str(i) for i in square])))


if __name__ == '__main__':
    main()
 from collections import deque def main():
    stack = deque()
    diagram = input()
    square = []

    for index, value in enumerate(diagram):
        if value == '\\':
            stack.append(-index)
        elif value == '/':
            if len(stack) > 0:
                tmp = []
                while True:
                    tmp.append(stack.pop())
                    if tmp[-1] <= 0:
                        stack.append(sum(tmp[:-1]) + index + tmp[-1])
                        break
                if len(stack) == 1:
                    square.append(stack.pop())
    square.extend([i for i in stack if i > 0])

    print(sum(square))
    if sum(square) == 0:
        print(0)
    else:
        print('{} {}'.format(len(square), ' '.join([str(i) for i in square]))) main stack = deque() stack deque() deque diagram = input() diagram input() input square = [] square [] for index, value in enumerate(diagram):
        if value == '\\':
            stack.append(-index)
        elif value == '/':
            if len(stack) > 0:
                tmp = []
                while True:
                    tmp.append(stack.pop())
                    if tmp[-1] <= 0:
                        stack.append(sum(tmp[:-1]) + index + tmp[-1])
                        break
                if len(stack) == 1:
                    square.append(stack.pop())
     index value enumerate(diagram) enumerate diagram if value == '\\':
            stack.append(-index)
        elif value == '/':
            if len(stack) > 0:
                tmp = []
                while True:
                    tmp.append(stack.pop())
                    if tmp[-1] <= 0:
                        stack.append(sum(tmp[:-1]) + index + tmp[-1])
                        break
                if len(stack) == 1:
                    square.append(stack.pop())
     value == '\\' value '\\' stack.append(-index) stack.append stack append -index index elif value == '/':
            if len(stack) > 0:
                tmp = []
                while True:
                    tmp.append(stack.pop())
                    if tmp[-1] <= 0:
                        stack.append(sum(tmp[:-1]) + index + tmp[-1])
                        break
                if len(stack) == 1:
                    square.append(stack.pop())
     value == '/' value '/' if len(stack) > 0:
                tmp = []
                while True:
                    tmp.append(stack.pop())
                    if tmp[-1] <= 0:
                        stack.append(sum(tmp[:-1]) + index + tmp[-1])
                        break
                if len(stack) == 1:
                    square.append(stack.pop())
     len(stack) > 0 len(stack) len stack 0 tmp = [] tmp [] while True:
                    tmp.append(stack.pop())
                    if tmp[-1] <= 0:
                        stack.append(sum(tmp[:-1]) + index + tmp[-1])
                        break
                 True tmp.append(stack.pop()) tmp.append tmp append stack.pop() stack.pop stack pop if tmp[-1] <= 0:
                        stack.append(sum(tmp[:-1]) + index + tmp[-1])
                        break
                 tmp[-1] <= 0 tmp[-1] tmp -1 0 stack.append(sum(tmp[:-1]) + index + tmp[-1]) stack.append stack append sum(tmp[:-1]) + index + tmp[-1] sum(tmp[:-1]) + index sum(tmp[:-1]) sum tmp[:-1] tmp :-1 -1 index tmp[-1] tmp -1 break if len(stack) == 1:
                    square.append(stack.pop())
     len(stack) == 1 len(stack) len stack 1 square.append(stack.pop()) square.append square append stack.pop() stack.pop stack pop i for i in stack if i > 0 for i in stack if i > 0 i stack i > 0 i 0 if i > 0 i square.extend([i for i in stack if i > 0]) square.extend square extend [i for i in stack if i > 0] print(sum(square)) print sum(square) sum square if sum(square) == 0:
        print(0)
    else:
        print('{} {}'.format(len(square), ' '.join([str(i) for i in square]))) sum(square) == 0 sum(square) sum square 0 print(0) print 0 str(i) for i in square for i in square i square for i in square str(i) str i print('{} {}'.format(len(square), ' '.join([str(i) for i in square]))) print '{} {}'.format(len(square), ' '.join([str(i) for i in square])) '{} {}'.format '{} {}' format len(square) len square ' '.join([str(i) for i in square]) ' '.join ' ' join [str(i) for i in square] if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    stack = deque()
    diagram = input()
    square = []

    for index, value in enumerate(diagram):
        if value == '\\':
            stack.append(-index)
        elif value == '/':
            if len(stack) > 0:
                tmp = []
                while True:
                    tmp.append(stack.pop())
                    if tmp[-1] <= 0:
                        stack.append(sum(tmp[:-1]) + index + tmp[-1])
                        break
                if len(stack) == 1:
                    square.append(stack.pop())
    square.extend([i for i in stack if i > 0])

    print(sum(square))
    if sum(square) == 0:
        print(0)
    else:
        print('{} {}'.format(len(square), ' '.join([str(i) for i in square]))) def main():
    stack = deque()
    diagram = input()
    square = []

    for index, value in enumerate(diagram):
        if value == '\\':
            stack.append(-index)
        elif value == '/':
            if len(stack) > 0:
                tmp = []
                while True:
                    tmp.append(stack.pop())
                    if tmp[-1] <= 0:
                        stack.append(sum(tmp[:-1]) + index + tmp[-1])
                        break
                if len(stack) == 1:
                    square.append(stack.pop())
    square.extend([i for i in stack if i > 0])

    print(sum(square))
    if sum(square) == 0:
        print(0)
    else:
        print('{} {}'.format(len(square), ' '.join([str(i) for i in square]))) main
from collections import deque


def main():
    stack = deque()
    diagram = input()
    square = []

    for index, value in enumerate(diagram):
        if value == '\\':
            stack.append(-index)
        elif value == '/':
            if len(stack) > 0:
                tmp = []
                while True:
                    tmp.append(stack.pop())
                    if tmp[-1] <= 0:
                        stack.append(sum(tmp[:-1]) + index + tmp[-1])
                        break
                if len(stack) == 1:
                    square.append(stack.pop())
    square.extend([i for i in stack if i > 0])

    print(sum(square))
    if sum(square) == 0:
        print(0)
    else:
        print('{} {}'.format(len(square), ' '.join([str(i) for i in square])))


if __name__ == '__main__':
    main()

