import sys


def read_heights():
    current = 0
    heights = [current]
    for c in sys.stdin.read().strip():
        current += {
            '/': 1,
            '\\': -1,
            '_': 0
        }[c]
        heights.append(current)
    return heights


heights = read_heights()

height_index = {}
for i, h in enumerate(heights):
    height_index.setdefault(h, []).append(i)

flooded = [False] * len(heights)
floods = []

# search from highest points
for h in sorted(height_index.keys(), reverse=True):
    indexes = height_index[h]
    for i in range(len(indexes) - 1):
        start = indexes[i]
        stop = indexes[i + 1]
        if start + 1 == stop or flooded[start] or flooded[stop]:
            continue
        if any(heights[j] >= h for j in range(start + 1, stop)):
            continue
        # flood in (start..stop)
        floods.append((start, stop))
        for j in range(start, stop):
            flooded[j] = True

floods.sort()

areas = []
for start, stop in floods:
    area = 0
    top = heights[start]
    for i in range(start + 1, stop + 1):
        h = heights[i]
        area += top - h + (heights[i - 1] - h) * 0.5
    areas.append(int(area))

print(sum(areas))
print(' '.join([str(v) for v in [len(areas)] + areas]))
 import sys sys def read_heights():
    current = 0
    heights = [current]
    for c in sys.stdin.read().strip():
        current += {
            '/': 1,
            '\\': -1,
            '_': 0
        }[c]
        heights.append(current)
    return heights read_heights current = 0 current 0 heights = [current] heights [current] current for c in sys.stdin.read().strip():
        current += {
            '/': 1,
            '\\': -1,
            '_': 0
        }[c]
        heights.append(current)
     c sys.stdin.read().strip() sys.stdin.read().strip sys.stdin.read() sys.stdin.read sys.stdin sys stdin read strip current += {
            '/': 1,
            '\\': -1,
            '_': 0
        }[c] current {
            '/': 1,
            '\\': -1,
            '_': 0
        }[c] {
            '/': 1,
            '\\': -1,
            '_': 0
        } '/' '/' 1 '\\' '\\' -1 '_' '_' 0 c heights.append(current) heights.append heights append current return heights heights heights = read_heights() heights read_heights() read_heights height_index = {} height_index {} for i, h in enumerate(heights):
    height_index.setdefault(h, []).append(i) i h enumerate(heights) enumerate heights height_index.setdefault(h, []).append(i) height_index.setdefault(h, []).append height_index.setdefault(h, []) height_index.setdefault height_index setdefault h [] append i flooded = [False] * len(heights) flooded [False] * len(heights) [False] False len(heights) len heights floods = [] floods [] for h in sorted(height_index.keys(), reverse=True):
    indexes = height_index[h]
    for i in range(len(indexes) - 1):
        start = indexes[i]
        stop = indexes[i + 1]
        if start + 1 == stop or flooded[start] or flooded[stop]:
            continue
        if any(heights[j] >= h for j in range(start + 1, stop)):
            continue
        # flood in (start..stop)
        floods.append((start, stop))
        for j in range(start, stop):
            flooded[j] = True h sorted(height_index.keys(), reverse=True) sorted height_index.keys() height_index.keys height_index keys reverse=True reverse True indexes = height_index[h] indexes height_index[h] height_index h for i in range(len(indexes) - 1):
        start = indexes[i]
        stop = indexes[i + 1]
        if start + 1 == stop or flooded[start] or flooded[stop]:
            continue
        if any(heights[j] >= h for j in range(start + 1, stop)):
            continue
        # flood in (start..stop)
        floods.append((start, stop))
        for j in range(start, stop):
            flooded[j] = True i range(len(indexes) - 1) range len(indexes) - 1 len(indexes) len indexes 1 start = indexes[i] start indexes[i] indexes i stop = indexes[i + 1] stop indexes[i + 1] indexes i + 1 i 1 if start + 1 == stop or flooded[start] or flooded[stop]:
            continue
         start + 1 == stop or flooded[start] or flooded[stop] start + 1 == stop or flooded[start] start + 1 == stop start + 1 start 1 stop flooded[start] flooded start flooded[stop] flooded stop continue if any(heights[j] >= h for j in range(start + 1, stop)):
            continue
        # flood in (start..stop)
         any(heights[j] >= h for j in range(start + 1, stop)) any heights[j] >= h heights[j] heights j h continue floods.append((start, stop)) floods.append floods append (start, stop) start stop for j in range(start, stop):
            flooded[j] = True j range(start, stop) range start stop flooded[j] = True flooded[j] flooded j True floods.sort() floods.sort floods sort areas = [] areas [] for start, stop in floods:
    area = 0
    top = heights[start]
    for i in range(start + 1, stop + 1):
        h = heights[i]
        area += top - h + (heights[i - 1] - h) * 0.5
    areas.append(int(area)) start stop floods area = 0 area 0 top = heights[start] top heights[start] heights start for i in range(start + 1, stop + 1):
        h = heights[i]
        area += top - h + (heights[i - 1] - h) * 0.5
     i range(start + 1, stop + 1) range start + 1 start 1 stop + 1 stop 1 h = heights[i] h heights[i] heights i area += top - h + (heights[i - 1] - h) * 0.5 area top - h + (heights[i - 1] - h) * 0.5 top - h top h (heights[i - 1] - h) * 0.5 heights[i - 1] - h heights[i - 1] heights i - 1 i 1 h 0.5 areas.append(int(area)) areas.append areas append int(area) int area print(sum(areas)) print sum(areas) sum areas str(v) for v in [len(areas)] + areas for v in [len(areas)] + areas v [len(areas)] + areas [len(areas)] len(areas) len areas areas for v in [len(areas)] + areas str(v) str v print(' '.join([str(v) for v in [len(areas)] + areas])) print ' '.join([str(v) for v in [len(areas)] + areas]) ' '.join ' ' join [str(v) for v in [len(areas)] + areas] height_index = {} {} height_index area += top - h + (heights[i - 1] - h) * 0.5 top - h + (heights[i - 1] - h) * 0.5 area top = heights[start] heights[start] top stop = indexes[i + 1] indexes[i + 1] stop area = 0 0 area flooded = [False] * len(heights) [False] * len(heights) flooded areas = [] [] areas heights = read_heights() read_heights() heights start = indexes[i] indexes[i] start floods = [] [] floods indexes = height_index[h] height_index[h] indexes def read_heights():
    current = 0
    heights = [current]
    for c in sys.stdin.read().strip():
        current += {
            '/': 1,
            '\\': -1,
            '_': 0
        }[c]
        heights.append(current)
    return heights def read_heights():
    current = 0
    heights = [current]
    for c in sys.stdin.read().strip():
        current += {
            '/': 1,
            '\\': -1,
            '_': 0
        }[c]
        heights.append(current)
    return heights read_heights h = heights[i] heights[i] h
import sys


def read_heights():
    current = 0
    heights = [current]
    for c in sys.stdin.read().strip():
        current += {
            '/': 1,
            '\\': -1,
            '_': 0
        }[c]
        heights.append(current)
    return heights


heights = read_heights()

height_index = {}
for i, h in enumerate(heights):
    height_index.setdefault(h, []).append(i)

flooded = [False] * len(heights)
floods = []

# search from highest points
for h in sorted(height_index.keys(), reverse=True):
    indexes = height_index[h]
    for i in range(len(indexes) - 1):
        start = indexes[i]
        stop = indexes[i + 1]
        if start + 1 == stop or flooded[start] or flooded[stop]:
            continue
        if any(heights[j] >= h for j in range(start + 1, stop)):
            continue
        # flood in (start..stop)
        floods.append((start, stop))
        for j in range(start, stop):
            flooded[j] = True

floods.sort()

areas = []
for start, stop in floods:
    area = 0
    top = heights[start]
    for i in range(start + 1, stop + 1):
        h = heights[i]
        area += top - h + (heights[i - 1] - h) * 0.5
    areas.append(int(area))

print(sum(areas))
print(' '.join([str(v) for v in [len(areas)] + areas]))

