def marge_ponds(lx, area_of_pond):
    global ponds
    if ponds:
        lp = ponds.pop()
        if lp[0] > lx:
            return marge_ponds(lx, area_of_pond + lp[1])
        else:
            ponds.append(lp)
    return area_of_pond


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

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

print(sum(pond[1] for pond in ponds))
ponds.insert(0, (0, len(ponds)))
print(' '.join(map(str, [pond[1] for pond in ponds]))) def marge_ponds(lx, area_of_pond):
    global ponds
    if ponds:
        lp = ponds.pop()
        if lp[0] > lx:
            return marge_ponds(lx, area_of_pond + lp[1])
        else:
            ponds.append(lp)
    return area_of_pond marge_ponds global ponds if ponds:
        lp = ponds.pop()
        if lp[0] > lx:
            return marge_ponds(lx, area_of_pond + lp[1])
        else:
            ponds.append(lp)
     ponds lp = ponds.pop() lp ponds.pop() ponds.pop ponds pop if lp[0] > lx:
            return marge_ponds(lx, area_of_pond + lp[1])
        else:
            ponds.append(lp)
     lp[0] > lx lp[0] lp 0 lx return marge_ponds(lx, area_of_pond + lp[1]) marge_ponds(lx, area_of_pond + lp[1]) marge_ponds lx area_of_pond + lp[1] area_of_pond lp[1] lp 1 ponds.append(lp) ponds.append ponds append lp 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, [], [] x 0 last_x [] ponds [] for terrain in terrains:
    if terrain == '\\':
        last_x.append(x)
    elif terrain == '/':
        if last_x:
            lx = last_x.pop()
            area_of_pond = marge_ponds(lx, x - lx)
            ponds.append((lx, area_of_pond))
    x += 1 terrain terrains if terrain == '\\':
        last_x.append(x)
    elif terrain == '/':
        if last_x:
            lx = last_x.pop()
            area_of_pond = marge_ponds(lx, x - lx)
            ponds.append((lx, area_of_pond))
     terrain == '\\' terrain '\\' last_x.append(x) last_x.append last_x append x elif terrain == '/':
        if last_x:
            lx = last_x.pop()
            area_of_pond = marge_ponds(lx, x - lx)
            ponds.append((lx, area_of_pond))
     terrain == '/' terrain '/' if last_x:
            lx = last_x.pop()
            area_of_pond = marge_ponds(lx, x - lx)
            ponds.append((lx, area_of_pond))
     last_x lx = last_x.pop() lx last_x.pop() last_x.pop last_x pop area_of_pond = marge_ponds(lx, x - lx) area_of_pond marge_ponds(lx, x - lx) marge_ponds lx x - lx x lx ponds.append((lx, area_of_pond)) ponds.append ponds append (lx, area_of_pond) lx area_of_pond 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.insert(0, (0, len(ponds))) ponds.insert ponds insert 0 (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] last_x, ponds = 0, [], [] [] last_x area_of_pond = marge_ponds(lx, x - lx) marge_ponds(lx, x - lx) area_of_pond def marge_ponds(lx, area_of_pond):
    global ponds
    if ponds:
        lp = ponds.pop()
        if lp[0] > lx:
            return marge_ponds(lx, area_of_pond + lp[1])
        else:
            ponds.append(lp)
    return area_of_pond def marge_ponds(lx, area_of_pond):
    global ponds
    if ponds:
        lp = ponds.pop()
        if lp[0] > lx:
            return marge_ponds(lx, area_of_pond + lp[1])
        else:
            ponds.append(lp)
    return area_of_pond marge_ponds terrains = input().strip() input().strip() terrains ponds = 0, [], [] [] ponds x, last_x, ponds = 0, [], [] 0 x lx = last_x.pop() last_x.pop() lx x += 1 1 x
def marge_ponds(lx, area_of_pond):
    global ponds
    if ponds:
        lp = ponds.pop()
        if lp[0] > lx:
            return marge_ponds(lx, area_of_pond + lp[1])
        else:
            ponds.append(lp)
    return area_of_pond


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

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

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