total_stack = []
single_stack = []

def main():
    input_line = input()
    total = 0

    for i,s in enumerate(input_line):
        if s == "\\":
            total_stack.append(i)
        elif s == "/" and len(total_stack) != 0:
            a = total_stack.pop()
            total += i - a
            area = 0
            while len(single_stack) != 0 and a < single_stack[-1][0]:
                area += single_stack.pop()[1]
            single_stack.append([a, area + i - a])

    print(total)
    print(' '.join([str(len(single_stack))] + [str(i[1]) for i in single_stack]))

if __name__ == '__main__':
    main() total_stack = [] total_stack [] single_stack = [] single_stack [] def main():
    input_line = input()
    total = 0

    for i,s in enumerate(input_line):
        if s == "\\":
            total_stack.append(i)
        elif s == "/" and len(total_stack) != 0:
            a = total_stack.pop()
            total += i - a
            area = 0
            while len(single_stack) != 0 and a < single_stack[-1][0]:
                area += single_stack.pop()[1]
            single_stack.append([a, area + i - a])

    print(total)
    print(' '.join([str(len(single_stack))] + [str(i[1]) for i in single_stack])) main input_line = input() input_line input() input total = 0 total 0 for i,s in enumerate(input_line):
        if s == "\\":
            total_stack.append(i)
        elif s == "/" and len(total_stack) != 0:
            a = total_stack.pop()
            total += i - a
            area = 0
            while len(single_stack) != 0 and a < single_stack[-1][0]:
                area += single_stack.pop()[1]
            single_stack.append([a, area + i - a])

     i s enumerate(input_line) enumerate input_line if s == "\\":
            total_stack.append(i)
        elif s == "/" and len(total_stack) != 0:
            a = total_stack.pop()
            total += i - a
            area = 0
            while len(single_stack) != 0 and a < single_stack[-1][0]:
                area += single_stack.pop()[1]
            single_stack.append([a, area + i - a])

     s == "\\" s "\\" total_stack.append(i) total_stack.append total_stack append i elif s == "/" and len(total_stack) != 0:
            a = total_stack.pop()
            total += i - a
            area = 0
            while len(single_stack) != 0 and a < single_stack[-1][0]:
                area += single_stack.pop()[1]
            single_stack.append([a, area + i - a])

     s == "/" and len(total_stack) != 0 s == "/" s "/" len(total_stack) != 0 len(total_stack) len total_stack 0 a = total_stack.pop() a total_stack.pop() total_stack.pop total_stack pop total += i - a total i - a i a area = 0 area 0 while len(single_stack) != 0 and a < single_stack[-1][0]:
                area += single_stack.pop()[1]
             len(single_stack) != 0 and a < single_stack[-1][0] len(single_stack) != 0 len(single_stack) len single_stack 0 a < single_stack[-1][0] a single_stack[-1][0] [-1] single_stack -1 0 area += single_stack.pop()[1] area single_stack.pop()[1] single_stack.pop() single_stack.pop single_stack pop 1 single_stack.append([a, area + i - a]) single_stack.append single_stack append [a, area + i - a] a area + i - a area + i area i a print(total) print total str(i[1]) for i in single_stack for i in single_stack i single_stack for i in single_stack str(i[1]) str i[1] i 1 print(' '.join([str(len(single_stack))] + [str(i[1]) for i in single_stack])) print ' '.join([str(len(single_stack))] + [str(i[1]) for i in single_stack]) ' '.join ' ' join [str(len(single_stack))] + [str(i[1]) for i in single_stack] [str(len(single_stack))] str(len(single_stack)) str len(single_stack) len single_stack [str(i[1]) for i in single_stack] if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main single_stack = [] [] single_stack total_stack = [] [] total_stack def main():
    input_line = input()
    total = 0

    for i,s in enumerate(input_line):
        if s == "\\":
            total_stack.append(i)
        elif s == "/" and len(total_stack) != 0:
            a = total_stack.pop()
            total += i - a
            area = 0
            while len(single_stack) != 0 and a < single_stack[-1][0]:
                area += single_stack.pop()[1]
            single_stack.append([a, area + i - a])

    print(total)
    print(' '.join([str(len(single_stack))] + [str(i[1]) for i in single_stack])) def main():
    input_line = input()
    total = 0

    for i,s in enumerate(input_line):
        if s == "\\":
            total_stack.append(i)
        elif s == "/" and len(total_stack) != 0:
            a = total_stack.pop()
            total += i - a
            area = 0
            while len(single_stack) != 0 and a < single_stack[-1][0]:
                area += single_stack.pop()[1]
            single_stack.append([a, area + i - a])

    print(total)
    print(' '.join([str(len(single_stack))] + [str(i[1]) for i in single_stack])) main
total_stack = []
single_stack = []

def main():
    input_line = input()
    total = 0

    for i,s in enumerate(input_line):
        if s == "\\":
            total_stack.append(i)
        elif s == "/" and len(total_stack) != 0:
            a = total_stack.pop()
            total += i - a
            area = 0
            while len(single_stack) != 0 and a < single_stack[-1][0]:
                area += single_stack.pop()[1]
            single_stack.append([a, area + i - a])

    print(total)
    print(' '.join([str(len(single_stack))] + [str(i[1]) for i in single_stack]))

if __name__ == '__main__':
    main()
