import sys
input = sys.stdin.readline

area_data = input()
total_area = 0
temp_area = 0

stack1 = []
stack2 = []

now_position = 0
for c in area_data:
    if c == '\\':
        stack1.append(now_position)
    elif c == '/':
        if len(stack1) > 0:
            last_potision = stack1.pop()
            temp_area = (now_position - last_potision)
            total_area += temp_area  # 前の\からの距離が、そのまま面積になる

            # print("before stack:{}".format(stack2))
            while len(stack2) > 0:
                prev_spot = stack2.pop()
                # print("prev spot:{}".format(prev_spot))
                # print("last_potision:{}".format(last_potision))
                if prev_spot[0] > last_potision:
                    temp_area += prev_spot[1]
                else:
                    stack2.append(prev_spot)
                    break

            stack2.append((last_potision, temp_area))

        # print("stack2:{}".format(stack2))

    now_position += 1

print(total_area)
print(len(stack2), end="")
for s in stack2:
    print(" ", end="")
    print(s[1], end="")
print()
 import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline area_data = input() area_data input() input total_area = 0 total_area 0 temp_area = 0 temp_area 0 stack1 = [] stack1 [] stack2 = [] stack2 [] now_position = 0 now_position 0 for c in area_data:
    if c == '\\':
        stack1.append(now_position)
    elif c == '/':
        if len(stack1) > 0:
            last_potision = stack1.pop()
            temp_area = (now_position - last_potision)
            total_area += temp_area  # 前の\からの距離が、そのまま面積になる

            # print("before stack:{}".format(stack2))
            while len(stack2) > 0:
                prev_spot = stack2.pop()
                # print("prev spot:{}".format(prev_spot))
                # print("last_potision:{}".format(last_potision))
                if prev_spot[0] > last_potision:
                    temp_area += prev_spot[1]
                else:
                    stack2.append(prev_spot)
                    break

            stack2.append((last_potision, temp_area))

        # print("stack2:{}".format(stack2))

    now_position += 1 c area_data if c == '\\':
        stack1.append(now_position)
    elif c == '/':
        if len(stack1) > 0:
            last_potision = stack1.pop()
            temp_area = (now_position - last_potision)
            total_area += temp_area  # 前の\からの距離が、そのまま面積になる

            # print("before stack:{}".format(stack2))
            while len(stack2) > 0:
                prev_spot = stack2.pop()
                # print("prev spot:{}".format(prev_spot))
                # print("last_potision:{}".format(last_potision))
                if prev_spot[0] > last_potision:
                    temp_area += prev_spot[1]
                else:
                    stack2.append(prev_spot)
                    break

            stack2.append((last_potision, temp_area))

        # print("stack2:{}".format(stack2))

     c == '\\' c '\\' stack1.append(now_position) stack1.append stack1 append now_position elif c == '/':
        if len(stack1) > 0:
            last_potision = stack1.pop()
            temp_area = (now_position - last_potision)
            total_area += temp_area  # 前の\からの距離が、そのまま面積になる

            # print("before stack:{}".format(stack2))
            while len(stack2) > 0:
                prev_spot = stack2.pop()
                # print("prev spot:{}".format(prev_spot))
                # print("last_potision:{}".format(last_potision))
                if prev_spot[0] > last_potision:
                    temp_area += prev_spot[1]
                else:
                    stack2.append(prev_spot)
                    break

            stack2.append((last_potision, temp_area))

        # print("stack2:{}".format(stack2))

     c == '/' c '/' if len(stack1) > 0:
            last_potision = stack1.pop()
            temp_area = (now_position - last_potision)
            total_area += temp_area  # 前の\からの距離が、そのまま面積になる

            # print("before stack:{}".format(stack2))
            while len(stack2) > 0:
                prev_spot = stack2.pop()
                # print("prev spot:{}".format(prev_spot))
                # print("last_potision:{}".format(last_potision))
                if prev_spot[0] > last_potision:
                    temp_area += prev_spot[1]
                else:
                    stack2.append(prev_spot)
                    break

            stack2.append((last_potision, temp_area))

        # print("stack2:{}".format(stack2))

     len(stack1) > 0 len(stack1) len stack1 0 last_potision = stack1.pop() last_potision stack1.pop() stack1.pop stack1 pop temp_area = (now_position - last_potision) temp_area now_position - last_potision now_position last_potision total_area += temp_area total_area temp_area while len(stack2) > 0:
                prev_spot = stack2.pop()
                # print("prev spot:{}".format(prev_spot))
                # print("last_potision:{}".format(last_potision))
                if prev_spot[0] > last_potision:
                    temp_area += prev_spot[1]
                else:
                    stack2.append(prev_spot)
                    break

             len(stack2) > 0 len(stack2) len stack2 0 prev_spot = stack2.pop() prev_spot stack2.pop() stack2.pop stack2 pop if prev_spot[0] > last_potision:
                    temp_area += prev_spot[1]
                else:
                    stack2.append(prev_spot)
                    break

             prev_spot[0] > last_potision prev_spot[0] prev_spot 0 last_potision temp_area += prev_spot[1] temp_area prev_spot[1] prev_spot 1 stack2.append(prev_spot) stack2.append stack2 append prev_spot break stack2.append((last_potision, temp_area)) stack2.append stack2 append (last_potision, temp_area) last_potision temp_area now_position += 1 now_position 1 print(total_area) print total_area print(len(stack2), end="") print len(stack2) len stack2 end="" end "" for s in stack2:
    print(" ", end="")
    print(s[1], end="") s stack2 print(" ", end="") print " " end="" end "" print(s[1], end="") print s[1] s 1 end="" end "" print() print stack1 = [] [] stack1 now_position += 1 1 now_position now_position = 0 0 now_position temp_area = (now_position - last_potision) now_position - last_potision temp_area area_data = input() input() area_data input = sys.stdin.readline sys.stdin.readline input total_area += temp_area temp_area total_area temp_area = 0 0 temp_area total_area = 0 0 total_area last_potision = stack1.pop() stack1.pop() last_potision prev_spot = stack2.pop() stack2.pop() prev_spot temp_area += prev_spot[1] prev_spot[1] temp_area stack2 = [] [] stack2
import sys
input = sys.stdin.readline

area_data = input()
total_area = 0
temp_area = 0

stack1 = []
stack2 = []

now_position = 0
for c in area_data:
    if c == '\\':
        stack1.append(now_position)
    elif c == '/':
        if len(stack1) > 0:
            last_potision = stack1.pop()
            temp_area = (now_position - last_potision)
            total_area += temp_area  # 前の\からの距離が、そのまま面積になる

            # print("before stack:{}".format(stack2))
            while len(stack2) > 0:
                prev_spot = stack2.pop()
                # print("prev spot:{}".format(prev_spot))
                # print("last_potision:{}".format(last_potision))
                if prev_spot[0] > last_potision:
                    temp_area += prev_spot[1]
                else:
                    stack2.append(prev_spot)
                    break

            stack2.append((last_potision, temp_area))

        # print("stack2:{}".format(stack2))

    now_position += 1

print(total_area)
print(len(stack2), end="")
for s in stack2:
    print(" ", end="")
    print(s[1], end="")
print()

