inputString = input()
terrainWidth = len(inputString)+1

height = [0] # 土地の高さを求める (左端 = 0)
currentHeight = 0
for c in inputString:
    if c == '_':
        d = 0
    elif c == '/':
        d = 1
    elif c == '\\':
        d = -1
    else:
        pass
    currentHeight += d
    height.append(currentHeight)

leftMax = [] # 各地点における、その地点より左の最大高さを求める
currentMax = 0
for h in height:
    currentMax = max(h, currentMax)
    leftMax.append(currentMax)

rightMax = [0]*terrainWidth # 各地点における、その地点より右の最大高さを求める
currentMax = height[-1]
for i in range(len(height), 0, -1):
    currentMax = max(height[i-1], currentMax)
    rightMax[i-1] = currentMax

floodArea = 0
floodDepth = [0]*terrainWidth # 各地点の水位は leftMax と rightMax の最小値
for i in range(terrainWidth):
    floodDepth[i] = min(leftMax[i], rightMax[i]) - height[i]
    floodArea += floodDepth[i]

pools = []
inPool = False
for depth in floodDepth:
    if depth:
        if inPool:
            pools[-1] += depth
        else:
            inPool = True
            pools.append(depth)
    elif inPool:
        inPool = False

print(floodArea)
if pools:
    print(len(pools), ' '.join([str(p) for p in pools]))
else:
    print(0)
 inputString = input() inputString input() input terrainWidth = len(inputString)+1 terrainWidth len(inputString)+1 len(inputString) len inputString 1 height = [0] height [0] 0 currentHeight = 0 currentHeight 0 for c in inputString:
    if c == '_':
        d = 0
    elif c == '/':
        d = 1
    elif c == '\\':
        d = -1
    else:
        pass
    currentHeight += d
    height.append(currentHeight) c inputString if c == '_':
        d = 0
    elif c == '/':
        d = 1
    elif c == '\\':
        d = -1
    else:
        pass
     c == '_' c '_' d = 0 d 0 elif c == '/':
        d = 1
     c == '/' c '/' d = 1 d 1 elif c == '\\':
        d = -1
     c == '\\' c '\\' d = -1 d -1 currentHeight += d currentHeight d height.append(currentHeight) height.append height append currentHeight leftMax = [] leftMax [] currentMax = 0 currentMax 0 for h in height:
    currentMax = max(h, currentMax)
    leftMax.append(currentMax) h height currentMax = max(h, currentMax) currentMax max(h, currentMax) max h currentMax leftMax.append(currentMax) leftMax.append leftMax append currentMax rightMax = [0]*terrainWidth rightMax [0]*terrainWidth [0] 0 terrainWidth currentMax = height[-1] currentMax height[-1] height -1 for i in range(len(height), 0, -1):
    currentMax = max(height[i-1], currentMax)
    rightMax[i-1] = currentMax i range(len(height), 0, -1) range len(height) len height 0 -1 currentMax = max(height[i-1], currentMax) currentMax max(height[i-1], currentMax) max height[i-1] height i-1 i 1 currentMax rightMax[i-1] = currentMax rightMax[i-1] rightMax i-1 i 1 currentMax floodArea = 0 floodArea 0 floodDepth = [0]*terrainWidth floodDepth [0]*terrainWidth [0] 0 terrainWidth for i in range(terrainWidth):
    floodDepth[i] = min(leftMax[i], rightMax[i]) - height[i]
    floodArea += floodDepth[i] i range(terrainWidth) range terrainWidth floodDepth[i] = min(leftMax[i], rightMax[i]) - height[i] floodDepth[i] floodDepth i min(leftMax[i], rightMax[i]) - height[i] min(leftMax[i], rightMax[i]) min leftMax[i] leftMax i rightMax[i] rightMax i height[i] height i floodArea += floodDepth[i] floodArea floodDepth[i] floodDepth i pools = [] pools [] inPool = False inPool False for depth in floodDepth:
    if depth:
        if inPool:
            pools[-1] += depth
        else:
            inPool = True
            pools.append(depth)
    elif inPool:
        inPool = False depth floodDepth if depth:
        if inPool:
            pools[-1] += depth
        else:
            inPool = True
            pools.append(depth)
    elif inPool:
        inPool = False depth if inPool:
            pools[-1] += depth
        else:
            inPool = True
            pools.append(depth)
     inPool pools[-1] += depth pools[-1] pools -1 depth inPool = True inPool True pools.append(depth) pools.append pools append depth elif inPool:
        inPool = False inPool inPool = False inPool False print(floodArea) print floodArea if pools:
    print(len(pools), ' '.join([str(p) for p in pools]))
else:
    print(0) pools str(p) for p in pools for p in pools p pools for p in pools str(p) str p print(len(pools), ' '.join([str(p) for p in pools])) print len(pools) len pools ' '.join([str(p) for p in pools]) ' '.join ' ' join [str(p) for p in pools] print(0) print 0 currentMax = max(h, currentMax) max(h, currentMax) currentMax d = 1 1 d currentMax = height[-1] height[-1] currentMax currentHeight += d d currentHeight inputString = input() input() inputString inPool = False False inPool inPool = False False inPool terrainWidth = len(inputString)+1 len(inputString)+1 terrainWidth inPool = True True inPool currentMax = 0 0 currentMax floodArea = 0 0 floodArea floodArea += floodDepth[i] floodDepth[i] floodArea d = 0 0 d rightMax = [0]*terrainWidth [0]*terrainWidth rightMax currentMax = max(height[i-1], currentMax) max(height[i-1], currentMax) currentMax height = [0] [0] height currentHeight = 0 0 currentHeight leftMax = [] [] leftMax floodDepth = [0]*terrainWidth [0]*terrainWidth floodDepth d = -1 -1 d pools = [] [] pools
inputString = input()
terrainWidth = len(inputString)+1

height = [0] # 土地の高さを求める (左端 = 0)
currentHeight = 0
for c in inputString:
    if c == '_':
        d = 0
    elif c == '/':
        d = 1
    elif c == '\\':
        d = -1
    else:
        pass
    currentHeight += d
    height.append(currentHeight)

leftMax = [] # 各地点における、その地点より左の最大高さを求める
currentMax = 0
for h in height:
    currentMax = max(h, currentMax)
    leftMax.append(currentMax)

rightMax = [0]*terrainWidth # 各地点における、その地点より右の最大高さを求める
currentMax = height[-1]
for i in range(len(height), 0, -1):
    currentMax = max(height[i-1], currentMax)
    rightMax[i-1] = currentMax

floodArea = 0
floodDepth = [0]*terrainWidth # 各地点の水位は leftMax と rightMax の最小値
for i in range(terrainWidth):
    floodDepth[i] = min(leftMax[i], rightMax[i]) - height[i]
    floodArea += floodDepth[i]

pools = []
inPool = False
for depth in floodDepth:
    if depth:
        if inPool:
            pools[-1] += depth
        else:
            inPool = True
            pools.append(depth)
    elif inPool:
        inPool = False

print(floodArea)
if pools:
    print(len(pools), ' '.join([str(p) for p in pools]))
else:
    print(0)

