"""
スタックのデータ構造の定義
"""

class Stack:
    def __init__(self):
        self.stack = []

    def push(self, num):
        self.stack.append(num)

    def individual_push(self, num):
        self.stack.append(num)

    def pop(self):
        if len(self.stack) > 0:
            return True, self.stack.pop(-1)
        else:
            return False, 0
    
    def push_individual(self, left_index, current_index):
        sum_a = 0
        for pair in reversed(self.stack):
            if pair[0] > left_index:
                _, a = self.pop()
                sum_a += a[1]
            else:
                break
        self.push((left_index, sum_a + (current_index - left_index)))

    def print_individual_volume(self):
        volume_list = [str(s[1]) for s in self.stack]
        if len(volume_list) == 0:
            print(0)
        else:
            print("{} ".format(len(volume_list)) + " ".join(volume_list))


if __name__=="__main__":
    input_values = input()

    stack1 = Stack()
    stack2 = Stack()
    area_sum = 0

    for i, v in enumerate(input_values):
        # print(i)

        if v == "\\":
            stack1.push(i)
        elif v == "/":
            result, pop_value = stack1.pop()
            if result:
                area = i - pop_value
                stack2.push_individual(pop_value, i)
            else:
                area = 0
            area_sum += area

    print(area_sum)
    stack2.print_individual_volume() """
スタックのデータ構造の定義
""" class Stack:
    def __init__(self):
        self.stack = []

    def push(self, num):
        self.stack.append(num)

    def individual_push(self, num):
        self.stack.append(num)

    def pop(self):
        if len(self.stack) > 0:
            return True, self.stack.pop(-1)
        else:
            return False, 0
    
    def push_individual(self, left_index, current_index):
        sum_a = 0
        for pair in reversed(self.stack):
            if pair[0] > left_index:
                _, a = self.pop()
                sum_a += a[1]
            else:
                break
        self.push((left_index, sum_a + (current_index - left_index)))

    def print_individual_volume(self):
        volume_list = [str(s[1]) for s in self.stack]
        if len(volume_list) == 0:
            print(0)
        else:
            print("{} ".format(len(volume_list)) + " ".join(volume_list)) Stack def __init__(self):
        self.stack = []

     __init__ self.stack = [] self.stack self stack [] self self def push(self, num):
        self.stack.append(num)

     push self.stack.append(num) self.stack.append self.stack self stack append num self self num num def individual_push(self, num):
        self.stack.append(num)

     individual_push self.stack.append(num) self.stack.append self.stack self stack append num self self num num def pop(self):
        if len(self.stack) > 0:
            return True, self.stack.pop(-1)
        else:
            return False, 0
    
     pop if len(self.stack) > 0:
            return True, self.stack.pop(-1)
        else:
            return False, 0
    
     len(self.stack) > 0 len(self.stack) len self.stack self stack 0 return True, self.stack.pop(-1) return True, self.stack.pop(-1) True self.stack.pop(-1) self.stack.pop self.stack self stack pop -1 return False, 0 return False, 0 False 0 self self def push_individual(self, left_index, current_index):
        sum_a = 0
        for pair in reversed(self.stack):
            if pair[0] > left_index:
                _, a = self.pop()
                sum_a += a[1]
            else:
                break
        self.push((left_index, sum_a + (current_index - left_index)))

     push_individual sum_a = 0 sum_a 0 for pair in reversed(self.stack):
            if pair[0] > left_index:
                _, a = self.pop()
                sum_a += a[1]
            else:
                break
         pair reversed(self.stack) reversed self.stack self stack if pair[0] > left_index:
                _, a = self.pop()
                sum_a += a[1]
            else:
                break
         pair[0] > left_index pair[0] pair 0 left_index _, a = self.pop() _ self.pop() self.pop self pop a sum_a += a[1] sum_a a[1] a 1 break self.push((left_index, sum_a + (current_index - left_index))) self.push self push (left_index, sum_a + (current_index - left_index)) left_index sum_a + (current_index - left_index) sum_a current_index - left_index current_index left_index self self left_index left_index current_index current_index def print_individual_volume(self):
        volume_list = [str(s[1]) for s in self.stack]
        if len(volume_list) == 0:
            print(0)
        else:
            print("{} ".format(len(volume_list)) + " ".join(volume_list)) print_individual_volume str(s[1]) for s in self.stack for s in self.stack s self.stack self stack for s in self.stack str(s[1]) str s[1] s 1 volume_list = [str(s[1]) for s in self.stack] volume_list [str(s[1]) for s in self.stack] if len(volume_list) == 0:
            print(0)
        else:
            print("{} ".format(len(volume_list)) + " ".join(volume_list)) len(volume_list) == 0 len(volume_list) len volume_list 0 print(0) print 0 print("{} ".format(len(volume_list)) + " ".join(volume_list)) print "{} ".format(len(volume_list)) + " ".join(volume_list) "{} ".format(len(volume_list)) "{} ".format "{} " format len(volume_list) len volume_list " ".join(volume_list) " ".join " " join volume_list self self if __name__=="__main__":
    input_values = input()

    stack1 = Stack()
    stack2 = Stack()
    area_sum = 0

    for i, v in enumerate(input_values):
        # print(i)

        if v == "\\":
            stack1.push(i)
        elif v == "/":
            result, pop_value = stack1.pop()
            if result:
                area = i - pop_value
                stack2.push_individual(pop_value, i)
            else:
                area = 0
            area_sum += area

    print(area_sum)
    stack2.print_individual_volume() __name__=="__main__" __name__ "__main__" input_values = input() input_values input() input stack1 = Stack() stack1 Stack() Stack stack2 = Stack() stack2 Stack() Stack area_sum = 0 area_sum 0 for i, v in enumerate(input_values):
        # print(i)

        if v == "\\":
            stack1.push(i)
        elif v == "/":
            result, pop_value = stack1.pop()
            if result:
                area = i - pop_value
                stack2.push_individual(pop_value, i)
            else:
                area = 0
            area_sum += area

     i v enumerate(input_values) enumerate input_values if v == "\\":
            stack1.push(i)
        elif v == "/":
            result, pop_value = stack1.pop()
            if result:
                area = i - pop_value
                stack2.push_individual(pop_value, i)
            else:
                area = 0
            area_sum += area

     v == "\\" v "\\" stack1.push(i) stack1.push stack1 push i elif v == "/":
            result, pop_value = stack1.pop()
            if result:
                area = i - pop_value
                stack2.push_individual(pop_value, i)
            else:
                area = 0
            area_sum += area

     v == "/" v "/" result, pop_value = stack1.pop() result stack1.pop() stack1.pop stack1 pop pop_value if result:
                area = i - pop_value
                stack2.push_individual(pop_value, i)
            else:
                area = 0
             result area = i - pop_value area i - pop_value i pop_value stack2.push_individual(pop_value, i) stack2.push_individual stack2 push_individual pop_value i area = 0 area 0 area_sum += area area_sum area print(area_sum) print area_sum stack2.print_individual_volume() stack2.print_individual_volume stack2 print_individual_volume area = i - pop_value i - pop_value area input_values = input() input() input_values stack1 = Stack() Stack() stack1 result, pop_value = stack1.pop() stack1.pop() result class Stack:
    def __init__(self):
        self.stack = []

    def push(self, num):
        self.stack.append(num)

    def individual_push(self, num):
        self.stack.append(num)

    def pop(self):
        if len(self.stack) > 0:
            return True, self.stack.pop(-1)
        else:
            return False, 0
    
    def push_individual(self, left_index, current_index):
        sum_a = 0
        for pair in reversed(self.stack):
            if pair[0] > left_index:
                _, a = self.pop()
                sum_a += a[1]
            else:
                break
        self.push((left_index, sum_a + (current_index - left_index)))

    def print_individual_volume(self):
        volume_list = [str(s[1]) for s in self.stack]
        if len(volume_list) == 0:
            print(0)
        else:
            print("{} ".format(len(volume_list)) + " ".join(volume_list)) class Stack:
    def __init__(self):
        self.stack = []

    def push(self, num):
        self.stack.append(num)

    def individual_push(self, num):
        self.stack.append(num)

    def pop(self):
        if len(self.stack) > 0:
            return True, self.stack.pop(-1)
        else:
            return False, 0
    
    def push_individual(self, left_index, current_index):
        sum_a = 0
        for pair in reversed(self.stack):
            if pair[0] > left_index:
                _, a = self.pop()
                sum_a += a[1]
            else:
                break
        self.push((left_index, sum_a + (current_index - left_index)))

    def print_individual_volume(self):
        volume_list = [str(s[1]) for s in self.stack]
        if len(volume_list) == 0:
            print(0)
        else:
            print("{} ".format(len(volume_list)) + " ".join(volume_list)) Stack stack2 = Stack() Stack() stack2 area_sum += area area area_sum area = 0 0 area area_sum = 0 0 area_sum pop_value = stack1.pop() stack1.pop() pop_value
"""
スタックのデータ構造の定義
"""

class Stack:
    def __init__(self):
        self.stack = []

    def push(self, num):
        self.stack.append(num)

    def individual_push(self, num):
        self.stack.append(num)

    def pop(self):
        if len(self.stack) > 0:
            return True, self.stack.pop(-1)
        else:
            return False, 0
    
    def push_individual(self, left_index, current_index):
        sum_a = 0
        for pair in reversed(self.stack):
            if pair[0] > left_index:
                _, a = self.pop()
                sum_a += a[1]
            else:
                break
        self.push((left_index, sum_a + (current_index - left_index)))

    def print_individual_volume(self):
        volume_list = [str(s[1]) for s in self.stack]
        if len(volume_list) == 0:
            print(0)
        else:
            print("{} ".format(len(volume_list)) + " ".join(volume_list))


if __name__=="__main__":
    input_values = input()

    stack1 = Stack()
    stack2 = Stack()
    area_sum = 0

    for i, v in enumerate(input_values):
        # print(i)

        if v == "\\":
            stack1.push(i)
        elif v == "/":
            result, pop_value = stack1.pop()
            if result:
                area = i - pop_value
                stack2.push_individual(pop_value, i)
            else:
                area = 0
            area_sum += area

    print(area_sum)
    stack2.print_individual_volume()
