from collections import deque


def marge_ponds(lx, area_of_pond):
    global ponds
    if ponds and ponds[-1][0] > lx:
        return marge_ponds(lx, area_of_pond + ponds.pop()[1])
    return area_of_pond


terrains = input().strip()
x, last_x, ponds = 0, deque(), deque()

for terrain in terrains:
    if terrain == '\\':
        last_x.append(x)
    elif terrain == '/':
        if last_x:
            lx = last_x.pop()
            ponds.append((lx, marge_ponds(lx, x - lx)))
    x += 1

print(sum(pond[1] for pond in ponds))
ponds.appendleft((0, len(ponds)))
print(' '.join(map(str, [pond[1] for pond in ponds]))) from collections import deque def marge_ponds(lx, area_of_pond):
    global ponds
    if ponds and ponds[-1][0] > lx:
        return marge_ponds(lx, area_of_pond + ponds.pop()[1])
    return area_of_pond marge_ponds global ponds if ponds and ponds[-1][0] > lx:
        return marge_ponds(lx, area_of_pond + ponds.pop()[1])
     ponds and ponds[-1][0] > lx ponds ponds[-1][0] > lx ponds[-1][0] [-1] ponds -1 0 lx return marge_ponds(lx, area_of_pond + ponds.pop()[1]) marge_ponds(lx, area_of_pond + ponds.pop()[1]) marge_ponds lx area_of_pond + ponds.pop()[1] area_of_pond ponds.pop()[1] ponds.pop() ponds.pop ponds pop 1 return area_of_pond area_of_pond lx lx area_of_pond area_of_pond terrains = input().strip() terrains input().strip() ().strip () input strip x, last_x, ponds = 0, deque(), deque() x 0 last_x deque() deque ponds deque() deque for terrain in terrains:
    if terrain == '\\':
        last_x.append(x)
    elif terrain == '/':
        if last_x:
            lx = last_x.pop()
            ponds.append((lx, marge_ponds(lx, x - lx)))
    x += 1 terrain terrains if terrain == '\\':
        last_x.append(x)
    elif terrain == '/':
        if last_x:
            lx = last_x.pop()
            ponds.append((lx, marge_ponds(lx, x - lx)))
     terrain == '\\' terrain '\\' last_x.append(x) last_x.append last_x append x elif terrain == '/':
        if last_x:
            lx = last_x.pop()
            ponds.append((lx, marge_ponds(lx, x - lx)))
     terrain == '/' terrain '/' if last_x:
            lx = last_x.pop()
            ponds.append((lx, marge_ponds(lx, x - lx)))
     last_x lx = last_x.pop() lx last_x.pop() last_x.pop last_x pop ponds.append((lx, marge_ponds(lx, x - lx))) ponds.append ponds append (lx, marge_ponds(lx, x - lx)) lx marge_ponds(lx, x - lx) marge_ponds lx x - lx x lx x += 1 x 1 print(sum(pond[1] for pond in ponds)) print sum(pond[1] for pond in ponds) sum pond[1] pond 1 ponds.appendleft((0, len(ponds))) ponds.appendleft ponds appendleft (0, len(ponds)) 0 len(ponds) len ponds pond[1] for pond in ponds for pond in ponds pond ponds for pond in ponds pond[1] pond 1 print(' '.join(map(str, [pond[1] for pond in ponds]))) print ' '.join(map(str, [pond[1] for pond in ponds])) ' '.join ' ' join map(str, [pond[1] for pond in ponds]) map str [pond[1] for pond in ponds] terrains = input().strip() input().strip() terrains last_x, ponds = 0, deque(), deque() deque() last_x ponds = 0, deque(), deque() deque() ponds x, last_x, ponds = 0, deque(), deque() 0 x lx = last_x.pop() last_x.pop() lx def marge_ponds(lx, area_of_pond):
    global ponds
    if ponds and ponds[-1][0] > lx:
        return marge_ponds(lx, area_of_pond + ponds.pop()[1])
    return area_of_pond def marge_ponds(lx, area_of_pond):
    global ponds
    if ponds and ponds[-1][0] > lx:
        return marge_ponds(lx, area_of_pond + ponds.pop()[1])
    return area_of_pond marge_ponds x += 1 1 x
from collections import deque


def marge_ponds(lx, area_of_pond):
    global ponds
    if ponds and ponds[-1][0] > lx:
        return marge_ponds(lx, area_of_pond + ponds.pop()[1])
    return area_of_pond


terrains = input().strip()
x, last_x, ponds = 0, deque(), deque()

for terrain in terrains:
    if terrain == '\\':
        last_x.append(x)
    elif terrain == '/':
        if last_x:
            lx = last_x.pop()
            ponds.append((lx, marge_ponds(lx, x - lx)))
    x += 1

print(sum(pond[1] for pond in ponds))
ponds.appendleft((0, len(ponds)))
print(' '.join(map(str, [pond[1] for pond in ponds])))