target = input()
now_height = []
now_area = [0]
answer = []
continued = 0
depth = 0
depth_list = []
for t in target:
    # print(now_height,depth_list,now_area,answer,continued)
    if t == '\\':
        now_height.append(continued)
        depth_list.append(depth)
        now_area.append(0)
        depth -= 1
    elif t == '_':
        pass
    elif t == '/' and len(now_height) > 0:
        depth += 1
        started = now_height.pop()
        temp_area = continued - started
        # print(depth_list[-1],depth)
        now_area[-1] += temp_area
        if depth > depth_list[-1]:
            while depth > depth_list[-1]:
                temp = now_area.pop()
                now_area[-1] += temp
                depth_list.pop()
        if len(now_height) == 0 or depth == depth_list[0]:
            answer.append(sum(now_area))
            now_area = [0]
            depth_list = []
    continued += 1
now_area = list(filter(lambda x:x != 0,now_area))
answer.extend(now_area)
print(sum(answer))
print(len(answer),*answer) target = input() target input() input now_height = [] now_height [] now_area = [0] now_area [0] 0 answer = [] answer [] continued = 0 continued 0 depth = 0 depth 0 depth_list = [] depth_list [] for t in target:
    # print(now_height,depth_list,now_area,answer,continued)
    if t == '\\':
        now_height.append(continued)
        depth_list.append(depth)
        now_area.append(0)
        depth -= 1
    elif t == '_':
        pass
    elif t == '/' and len(now_height) > 0:
        depth += 1
        started = now_height.pop()
        temp_area = continued - started
        # print(depth_list[-1],depth)
        now_area[-1] += temp_area
        if depth > depth_list[-1]:
            while depth > depth_list[-1]:
                temp = now_area.pop()
                now_area[-1] += temp
                depth_list.pop()
        if len(now_height) == 0 or depth == depth_list[0]:
            answer.append(sum(now_area))
            now_area = [0]
            depth_list = []
    continued += 1 t target if t == '\\':
        now_height.append(continued)
        depth_list.append(depth)
        now_area.append(0)
        depth -= 1
    elif t == '_':
        pass
    elif t == '/' and len(now_height) > 0:
        depth += 1
        started = now_height.pop()
        temp_area = continued - started
        # print(depth_list[-1],depth)
        now_area[-1] += temp_area
        if depth > depth_list[-1]:
            while depth > depth_list[-1]:
                temp = now_area.pop()
                now_area[-1] += temp
                depth_list.pop()
        if len(now_height) == 0 or depth == depth_list[0]:
            answer.append(sum(now_area))
            now_area = [0]
            depth_list = []
     t == '\\' t '\\' now_height.append(continued) now_height.append now_height append continued depth_list.append(depth) depth_list.append depth_list append depth now_area.append(0) now_area.append now_area append 0 depth -= 1 depth 1 elif t == '_':
        pass
     t == '_' t '_' elif t == '/' and len(now_height) > 0:
        depth += 1
        started = now_height.pop()
        temp_area = continued - started
        # print(depth_list[-1],depth)
        now_area[-1] += temp_area
        if depth > depth_list[-1]:
            while depth > depth_list[-1]:
                temp = now_area.pop()
                now_area[-1] += temp
                depth_list.pop()
        if len(now_height) == 0 or depth == depth_list[0]:
            answer.append(sum(now_area))
            now_area = [0]
            depth_list = []
     t == '/' and len(now_height) > 0 t == '/' t '/' len(now_height) > 0 len(now_height) len now_height 0 depth += 1 depth 1 started = now_height.pop() started now_height.pop() now_height.pop now_height pop temp_area = continued - started temp_area continued - started continued started now_area[-1] += temp_area now_area[-1] now_area -1 temp_area if depth > depth_list[-1]:
            while depth > depth_list[-1]:
                temp = now_area.pop()
                now_area[-1] += temp
                depth_list.pop()
         depth > depth_list[-1] depth depth_list[-1] depth_list -1 while depth > depth_list[-1]:
                temp = now_area.pop()
                now_area[-1] += temp
                depth_list.pop()
         depth > depth_list[-1] depth depth_list[-1] depth_list -1 temp = now_area.pop() temp now_area.pop() now_area.pop now_area pop now_area[-1] += temp now_area[-1] now_area -1 temp depth_list.pop() depth_list.pop depth_list pop if len(now_height) == 0 or depth == depth_list[0]:
            answer.append(sum(now_area))
            now_area = [0]
            depth_list = []
     len(now_height) == 0 or depth == depth_list[0] len(now_height) == 0 len(now_height) len now_height 0 depth == depth_list[0] depth depth_list[0] depth_list 0 answer.append(sum(now_area)) answer.append answer append sum(now_area) sum now_area now_area = [0] now_area [0] 0 depth_list = [] depth_list [] continued += 1 continued 1 now_area = list(filter(lambda x:x != 0,now_area)) now_area list(filter(lambda x:x != 0,now_area)) list filter(lambda x:x != 0,now_area) filter lambda x:x != 0 x != 0 x 0 x now_area answer.extend(now_area) answer.extend answer extend now_area print(sum(answer)) print sum(answer) sum answer print(len(answer),*answer) print len(answer) len answer *answer answer temp_area = continued - started continued - started temp_area temp = now_area.pop() now_area.pop() temp now_area = [0] [0] now_area depth -= 1 1 depth continued += 1 1 continued answer = [] [] answer depth += 1 1 depth depth = 0 0 depth continued = 0 0 continued target = input() input() target started = now_height.pop() now_height.pop() started depth_list = [] [] depth_list now_height = [] [] now_height depth_list = [] [] depth_list now_area = [0] [0] now_area now_area = list(filter(lambda x:x != 0,now_area)) list(filter(lambda x:x != 0,now_area)) now_area
target = input()
now_height = []
now_area = [0]
answer = []
continued = 0
depth = 0
depth_list = []
for t in target:
    # print(now_height,depth_list,now_area,answer,continued)
    if t == '\\':
        now_height.append(continued)
        depth_list.append(depth)
        now_area.append(0)
        depth -= 1
    elif t == '_':
        pass
    elif t == '/' and len(now_height) > 0:
        depth += 1
        started = now_height.pop()
        temp_area = continued - started
        # print(depth_list[-1],depth)
        now_area[-1] += temp_area
        if depth > depth_list[-1]:
            while depth > depth_list[-1]:
                temp = now_area.pop()
                now_area[-1] += temp
                depth_list.pop()
        if len(now_height) == 0 or depth == depth_list[0]:
            answer.append(sum(now_area))
            now_area = [0]
            depth_list = []
    continued += 1
now_area = list(filter(lambda x:x != 0,now_area))
answer.extend(now_area)
print(sum(answer))
print(len(answer),*answer)