from collections import deque

line = input()

s1 = deque()
s2 = deque()

n = len(line)
total_area = 0

for i in range(n):
    if line[i] == "\\":
        s1.append(i)
    elif line[i] == "/":
        if s1: # if s1 is not empty
            j = s1.pop()
            area = i - j
            total_area += area
            if s2 and j < s2[-1][0]: # integrate the area of ponds
                while s2 and j < s2[-1][0]:
                    pre_pond = s2.pop()[1]
                    area += pre_pond
            s2.append([j,area])

print(total_area) 
if total_area!=0:
    print("{} ".format(len(s2)) + " ".join([str(x[1]) for x in s2]))
else:
    print(0) from collections import deque line = input() line input() input s1 = deque() s1 deque() deque s2 = deque() s2 deque() deque n = len(line) n len(line) len line total_area = 0 total_area 0 for i in range(n):
    if line[i] == "\\":
        s1.append(i)
    elif line[i] == "/":
        if s1: # if s1 is not empty
            j = s1.pop()
            area = i - j
            total_area += area
            if s2 and j < s2[-1][0]: # integrate the area of ponds
                while s2 and j < s2[-1][0]:
                    pre_pond = s2.pop()[1]
                    area += pre_pond
            s2.append([j,area]) i range(n) range n if line[i] == "\\":
        s1.append(i)
    elif line[i] == "/":
        if s1: # if s1 is not empty
            j = s1.pop()
            area = i - j
            total_area += area
            if s2 and j < s2[-1][0]: # integrate the area of ponds
                while s2 and j < s2[-1][0]:
                    pre_pond = s2.pop()[1]
                    area += pre_pond
            s2.append([j,area]) line[i] == "\\" line[i] line i "\\" s1.append(i) s1.append s1 append i elif line[i] == "/":
        if s1: # if s1 is not empty
            j = s1.pop()
            area = i - j
            total_area += area
            if s2 and j < s2[-1][0]: # integrate the area of ponds
                while s2 and j < s2[-1][0]:
                    pre_pond = s2.pop()[1]
                    area += pre_pond
            s2.append([j,area]) line[i] == "/" line[i] line i "/" if s1: # if s1 is not empty
            j = s1.pop()
            area = i - j
            total_area += area
            if s2 and j < s2[-1][0]: # integrate the area of ponds
                while s2 and j < s2[-1][0]:
                    pre_pond = s2.pop()[1]
                    area += pre_pond
            s2.append([j,area]) s1 j = s1.pop() j s1.pop() s1.pop s1 pop area = i - j area i - j i j total_area += area total_area area if s2 and j < s2[-1][0]: # integrate the area of ponds
                while s2 and j < s2[-1][0]:
                    pre_pond = s2.pop()[1]
                    area += pre_pond
             s2 and j < s2[-1][0] s2 j < s2[-1][0] j s2[-1][0] [-1] s2 -1 0 while s2 and j < s2[-1][0]:
                    pre_pond = s2.pop()[1]
                    area += pre_pond
             s2 and j < s2[-1][0] s2 j < s2[-1][0] j s2[-1][0] [-1] s2 -1 0 pre_pond = s2.pop()[1] pre_pond s2.pop()[1] s2.pop() s2.pop s2 pop 1 area += pre_pond area pre_pond s2.append([j,area]) s2.append s2 append [j,area] j area print(total_area) print total_area if total_area!=0:
    print("{} ".format(len(s2)) + " ".join([str(x[1]) for x in s2]))
else:
    print(0) total_area!=0 total_area 0 str(x[1]) for x in s2 for x in s2 x s2 for x in s2 str(x[1]) str x[1] x 1 print("{} ".format(len(s2)) + " ".join([str(x[1]) for x in s2])) print "{} ".format(len(s2)) + " ".join([str(x[1]) for x in s2]) "{} ".format(len(s2)) "{} ".format "{} " format len(s2) len s2 " ".join([str(x[1]) for x in s2]) " ".join " " join [str(x[1]) for x in s2] print(0) print 0 area = i - j i - j area j = s1.pop() s1.pop() j line = input() input() line n = len(line) len(line) n area += pre_pond pre_pond area pre_pond = s2.pop()[1] s2.pop()[1] pre_pond total_area = 0 0 total_area s1 = deque() deque() s1 s2 = deque() deque() s2 total_area += area area total_area
from collections import deque

line = input()

s1 = deque()
s2 = deque()

n = len(line)
total_area = 0

for i in range(n):
    if line[i] == "\\":
        s1.append(i)
    elif line[i] == "/":
        if s1: # if s1 is not empty
            j = s1.pop()
            area = i - j
            total_area += area
            if s2 and j < s2[-1][0]: # integrate the area of ponds
                while s2 and j < s2[-1][0]:
                    pre_pond = s2.pop()[1]
                    area += pre_pond
            s2.append([j,area])

print(total_area) 
if total_area!=0:
    print("{} ".format(len(s2)) + " ".join([str(x[1]) for x in s2]))
else:
    print(0)
