# -*- coding: utf-8 -*-

import sys
import os


s = input().strip()

S1 = []  # sum of pond
S2 = []  # each pond
area = 0

for i, c in enumerate(s):
    if c == '\\':
        S1.append(i)
    elif c == '_':
        pass
    elif c == '/' and S1:
        j = S1.pop(-1)
        area += i - j

        # for each pond
        # ?????????????????????????????´???, pond?????±??????????????????
        pond_sum = i - j  # ???????????????????????¢???
        while S2 and S2[-1][0] > j:
            pond_sum += S2[-1][1]
            S2.pop(-1)
        S2.append([j, pond_sum])

pond_areas = []
for data in S2:
    pond_areas.append(data[1])

# answer
print(area)
print(len(pond_areas), *pond_areas) import sys sys import os os s = input().strip() s input().strip() ().strip () input strip S1 = [] S1 [] S2 = [] S2 [] area = 0 area 0 for i, c in enumerate(s):
    if c == '\\':
        S1.append(i)
    elif c == '_':
        pass
    elif c == '/' and S1:
        j = S1.pop(-1)
        area += i - j

        # for each pond
        # ?????????????????????????????´???, pond?????±??????????????????
        pond_sum = i - j  # ???????????????????????¢???
        while S2 and S2[-1][0] > j:
            pond_sum += S2[-1][1]
            S2.pop(-1)
        S2.append([j, pond_sum]) i c enumerate(s) enumerate s if c == '\\':
        S1.append(i)
    elif c == '_':
        pass
    elif c == '/' and S1:
        j = S1.pop(-1)
        area += i - j

        # for each pond
        # ?????????????????????????????´???, pond?????±??????????????????
        pond_sum = i - j  # ???????????????????????¢???
        while S2 and S2[-1][0] > j:
            pond_sum += S2[-1][1]
            S2.pop(-1)
        S2.append([j, pond_sum]) c == '\\' c '\\' S1.append(i) S1.append S1 append i elif c == '_':
        pass
     c == '_' c '_' elif c == '/' and S1:
        j = S1.pop(-1)
        area += i - j

        # for each pond
        # ?????????????????????????????´???, pond?????±??????????????????
        pond_sum = i - j  # ???????????????????????¢???
        while S2 and S2[-1][0] > j:
            pond_sum += S2[-1][1]
            S2.pop(-1)
        S2.append([j, pond_sum]) c == '/' and S1 c == '/' c '/' S1 j = S1.pop(-1) j S1.pop(-1) S1.pop S1 pop -1 area += i - j area i - j i j pond_sum = i - j pond_sum i - j i j while S2 and S2[-1][0] > j:
            pond_sum += S2[-1][1]
            S2.pop(-1)
         S2 and S2[-1][0] > j S2 S2[-1][0] > j S2[-1][0] [-1] S2 -1 0 j pond_sum += S2[-1][1] pond_sum S2[-1][1] [-1] S2 -1 1 S2.pop(-1) S2.pop S2 pop -1 S2.append([j, pond_sum]) S2.append S2 append [j, pond_sum] j pond_sum pond_areas = [] pond_areas [] for data in S2:
    pond_areas.append(data[1])

# answer data S2 pond_areas.append(data[1]) pond_areas.append pond_areas append data[1] data 1 print(area) print area print(len(pond_areas), *pond_areas) print len(pond_areas) len pond_areas *pond_areas pond_areas pond_sum = i - j i - j pond_sum pond_areas = [] [] pond_areas pond_sum += S2[-1][1] S2[-1][1] pond_sum area = 0 0 area S1 = [] [] S1 area += i - j i - j area j = S1.pop(-1) S1.pop(-1) j S2 = [] [] S2 s = input().strip() input().strip() s
# -*- coding: utf-8 -*-

import sys
import os


s = input().strip()

S1 = []  # sum of pond
S2 = []  # each pond
area = 0

for i, c in enumerate(s):
    if c == '\\':
        S1.append(i)
    elif c == '_':
        pass
    elif c == '/' and S1:
        j = S1.pop(-1)
        area += i - j

        # for each pond
        # ?????????????????????????????´???, pond?????±??????????????????
        pond_sum = i - j  # ???????????????????????¢???
        while S2 and S2[-1][0] > j:
            pond_sum += S2[-1][1]
            S2.pop(-1)
        S2.append([j, pond_sum])

pond_areas = []
for data in S2:
    pond_areas.append(data[1])

# answer
print(area)
print(len(pond_areas), *pond_areas)