#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

class peak():
    def __init__(self, loc, elevation):
        self.loc = loc
        self.elevation = elevation
        self.next_high = None


def peak_append(peak_list, loc, elevation):
    p = peak(loc, elevation)
    peak_list.append(p)
    return

def peak_set_next_high(peak_list):
    next_high = peak_list[-1]   # last peak
    for i in range(len(peak_list)-2, -1, -1):
        peak_list[i].next_high = next_high
        if peak_list[i].elevation >= next_high.elevation:
            next_high = peak_list[i]


def find_flood(elev_list, peak_list):
    peak_p = peak_list.pop(0)
    next_high = peak_p.next_high
    if not next_high:
        return None, None
    q_elev = next_high.elevation
    p_elev = peak_p.elevation

    if p_elev > q_elev:
        q_offset = next_high.loc
        p_offset = peak_p.loc
        while p_offset < len(elev_list):
            if elev_list[p_offset] == elev_list[q_offset]:
                return p_offset, q_offset
            p_offset += 1
        else:
            return None, None
    else:
        p_offset = peak_p.loc
        q_offset = elev_list.index(p_elev, p_offset+1)
        return p_offset, q_offset
    raise "Logic Error"


def calc_area(p, q, elev_list):
    elev_0 = elev_list[p]
    area = 0

    prev_elev = 0
    for x in range(p, q+1):
        elev = elev_list[x] - elev_0
        area += elev

    return (abs(area))


def adjust_peak_list(q, peak_list):
    while peak_list:
        if peak_list[0].loc >= q:
            return
        peak_list.pop(0)


s = list(sys.stdin.readline().strip())

flood_area = list()
peak_list = list()

ascending = True
elevation = 0
elev_list = list()

for i in range(len(s)):
    elev_list.append(elevation)

    if s[i] == '_':
        pass
    elif s[i] == '/':
        ascending = True
        elevation += 1
    elif s[i] == '\\':
        if ascending:
            peak_append(peak_list, i, elevation)
        ascending = False
        elevation -= 1

elev_list.append(elevation)

if ascending:
    peak_append(peak_list, len(s), elevation)

peak_set_next_high(peak_list)

while peak_list:
    p, q = find_flood(elev_list, peak_list)
    if p == None:
        break
    flood_area.append(calc_area(p, q, elev_list))
    adjust_peak_list(q, peak_list)
    
print(sum(flood_area))
print(len(flood_area), end='')
for i in range(len(flood_area)):
    print(' ', flood_area[i], sep='', end='')
print()
 import sys sys class peak():
    def __init__(self, loc, elevation):
        self.loc = loc
        self.elevation = elevation
        self.next_high = None peak def __init__(self, loc, elevation):
        self.loc = loc
        self.elevation = elevation
        self.next_high = None __init__ self.loc = loc self.loc self loc loc self.elevation = elevation self.elevation self elevation elevation self.next_high = None self.next_high self next_high None self self loc loc elevation elevation def peak_append(peak_list, loc, elevation):
    p = peak(loc, elevation)
    peak_list.append(p)
    return peak_append p = peak(loc, elevation) p peak(loc, elevation) peak loc elevation peak_list.append(p) peak_list.append peak_list append p return peak_list peak_list loc loc elevation elevation def peak_set_next_high(peak_list):
    next_high = peak_list[-1]   # last peak
    for i in range(len(peak_list)-2, -1, -1):
        peak_list[i].next_high = next_high
        if peak_list[i].elevation >= next_high.elevation:
            next_high = peak_list[i] peak_set_next_high next_high = peak_list[-1] next_high peak_list[-1] peak_list -1 for i in range(len(peak_list)-2, -1, -1):
        peak_list[i].next_high = next_high
        if peak_list[i].elevation >= next_high.elevation:
            next_high = peak_list[i] i range(len(peak_list)-2, -1, -1) range len(peak_list)-2 len(peak_list) len peak_list 2 -1 -1 peak_list[i].next_high = next_high peak_list[i].next_high [i] peak_list i next_high next_high if peak_list[i].elevation >= next_high.elevation:
            next_high = peak_list[i] peak_list[i].elevation >= next_high.elevation peak_list[i].elevation [i] peak_list i elevation next_high.elevation next_high elevation next_high = peak_list[i] next_high peak_list[i] peak_list i peak_list peak_list def find_flood(elev_list, peak_list):
    peak_p = peak_list.pop(0)
    next_high = peak_p.next_high
    if not next_high:
        return None, None
    q_elev = next_high.elevation
    p_elev = peak_p.elevation

    if p_elev > q_elev:
        q_offset = next_high.loc
        p_offset = peak_p.loc
        while p_offset < len(elev_list):
            if elev_list[p_offset] == elev_list[q_offset]:
                return p_offset, q_offset
            p_offset += 1
        else:
            return None, None
    else:
        p_offset = peak_p.loc
        q_offset = elev_list.index(p_elev, p_offset+1)
        return p_offset, q_offset
    raise "Logic Error" find_flood peak_p = peak_list.pop(0) peak_p peak_list.pop(0) peak_list.pop peak_list pop 0 next_high = peak_p.next_high next_high peak_p.next_high peak_p next_high if not next_high:
        return None, None
     not next_high next_high return None, None return None, None None None q_elev = next_high.elevation q_elev next_high.elevation next_high elevation p_elev = peak_p.elevation p_elev peak_p.elevation peak_p elevation if p_elev > q_elev:
        q_offset = next_high.loc
        p_offset = peak_p.loc
        while p_offset < len(elev_list):
            if elev_list[p_offset] == elev_list[q_offset]:
                return p_offset, q_offset
            p_offset += 1
        else:
            return None, None
    else:
        p_offset = peak_p.loc
        q_offset = elev_list.index(p_elev, p_offset+1)
        return p_offset, q_offset
     p_elev > q_elev p_elev q_elev q_offset = next_high.loc q_offset next_high.loc next_high loc p_offset = peak_p.loc p_offset peak_p.loc peak_p loc while p_offset < len(elev_list):
            if elev_list[p_offset] == elev_list[q_offset]:
                return p_offset, q_offset
            p_offset += 1
        else:
            return None, None
     p_offset < len(elev_list) p_offset len(elev_list) len elev_list if elev_list[p_offset] == elev_list[q_offset]:
                return p_offset, q_offset
             elev_list[p_offset] == elev_list[q_offset] elev_list[p_offset] elev_list p_offset elev_list[q_offset] elev_list q_offset return p_offset, q_offset return p_offset, q_offset p_offset q_offset p_offset += 1 p_offset 1 return None, None return None, None None None p_offset = peak_p.loc p_offset peak_p.loc peak_p loc q_offset = elev_list.index(p_elev, p_offset+1) q_offset elev_list.index(p_elev, p_offset+1) elev_list.index elev_list index p_elev p_offset+1 p_offset 1 return p_offset, q_offset return p_offset, q_offset p_offset q_offset raise "Logic Error" "Logic Error" elev_list elev_list peak_list peak_list def calc_area(p, q, elev_list):
    elev_0 = elev_list[p]
    area = 0

    prev_elev = 0
    for x in range(p, q+1):
        elev = elev_list[x] - elev_0
        area += elev

    return (abs(area)) calc_area elev_0 = elev_list[p] elev_0 elev_list[p] elev_list p area = 0 area 0 prev_elev = 0 prev_elev 0 for x in range(p, q+1):
        elev = elev_list[x] - elev_0
        area += elev

     x range(p, q+1) range p q+1 q 1 elev = elev_list[x] - elev_0 elev elev_list[x] - elev_0 elev_list[x] elev_list x elev_0 area += elev area elev return (abs(area)) abs(area) abs area p p q q elev_list elev_list def adjust_peak_list(q, peak_list):
    while peak_list:
        if peak_list[0].loc >= q:
            return
        peak_list.pop(0) adjust_peak_list while peak_list:
        if peak_list[0].loc >= q:
            return
        peak_list.pop(0) peak_list if peak_list[0].loc >= q:
            return
         peak_list[0].loc >= q peak_list[0].loc [0] peak_list 0 loc q return peak_list.pop(0) peak_list.pop peak_list pop 0 q q peak_list peak_list s = list(sys.stdin.readline().strip()) s list(sys.stdin.readline().strip()) list sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip flood_area = list() flood_area list() list peak_list = list() peak_list list() list ascending = True ascending True elevation = 0 elevation 0 elev_list = list() elev_list list() list for i in range(len(s)):
    elev_list.append(elevation)

    if s[i] == '_':
        pass
    elif s[i] == '/':
        ascending = True
        elevation += 1
    elif s[i] == '\\':
        if ascending:
            peak_append(peak_list, i, elevation)
        ascending = False
        elevation -= 1 i range(len(s)) range len(s) len s elev_list.append(elevation) elev_list.append elev_list append elevation if s[i] == '_':
        pass
    elif s[i] == '/':
        ascending = True
        elevation += 1
    elif s[i] == '\\':
        if ascending:
            peak_append(peak_list, i, elevation)
        ascending = False
        elevation -= 1 s[i] == '_' s[i] s i '_' elif s[i] == '/':
        ascending = True
        elevation += 1
     s[i] == '/' s[i] s i '/' ascending = True ascending True elevation += 1 elevation 1 elif s[i] == '\\':
        if ascending:
            peak_append(peak_list, i, elevation)
        ascending = False
        elevation -= 1 s[i] == '\\' s[i] s i '\\' if ascending:
            peak_append(peak_list, i, elevation)
         ascending peak_append(peak_list, i, elevation) peak_append peak_list i elevation ascending = False ascending False elevation -= 1 elevation 1 elev_list.append(elevation) elev_list.append elev_list append elevation if ascending:
    peak_append(peak_list, len(s), elevation) ascending peak_append(peak_list, len(s), elevation) peak_append peak_list len(s) len s elevation peak_set_next_high(peak_list) peak_set_next_high peak_list while peak_list:
    p, q = find_flood(elev_list, peak_list)
    if p == None:
        break
    flood_area.append(calc_area(p, q, elev_list))
    adjust_peak_list(q, peak_list)
     peak_list p, q = find_flood(elev_list, peak_list) p find_flood(elev_list, peak_list) find_flood elev_list peak_list q if p == None:
        break
     p == None p None break flood_area.append(calc_area(p, q, elev_list)) flood_area.append flood_area append calc_area(p, q, elev_list) calc_area p q elev_list adjust_peak_list(q, peak_list) adjust_peak_list q peak_list print(sum(flood_area)) print sum(flood_area) sum flood_area print(len(flood_area), end='') print len(flood_area) len flood_area end='' end '' for i in range(len(flood_area)):
    print(' ', flood_area[i], sep='', end='') i range(len(flood_area)) range len(flood_area) len flood_area print(' ', flood_area[i], sep='', end='') print ' ' flood_area[i] flood_area i sep='' sep '' end='' end '' print() print flood_area = list() list() flood_area s = list(sys.stdin.readline().strip()) list(sys.stdin.readline().strip()) s p, q = find_flood(elev_list, peak_list) find_flood(elev_list, peak_list) p peak_list = list() list() peak_list ascending = False False ascending def peak_set_next_high(peak_list):
    next_high = peak_list[-1]   # last peak
    for i in range(len(peak_list)-2, -1, -1):
        peak_list[i].next_high = next_high
        if peak_list[i].elevation >= next_high.elevation:
            next_high = peak_list[i] def peak_set_next_high(peak_list):
    next_high = peak_list[-1]   # last peak
    for i in range(len(peak_list)-2, -1, -1):
        peak_list[i].next_high = next_high
        if peak_list[i].elevation >= next_high.elevation:
            next_high = peak_list[i] peak_set_next_high def find_flood(elev_list, peak_list):
    peak_p = peak_list.pop(0)
    next_high = peak_p.next_high
    if not next_high:
        return None, None
    q_elev = next_high.elevation
    p_elev = peak_p.elevation

    if p_elev > q_elev:
        q_offset = next_high.loc
        p_offset = peak_p.loc
        while p_offset < len(elev_list):
            if elev_list[p_offset] == elev_list[q_offset]:
                return p_offset, q_offset
            p_offset += 1
        else:
            return None, None
    else:
        p_offset = peak_p.loc
        q_offset = elev_list.index(p_elev, p_offset+1)
        return p_offset, q_offset
    raise "Logic Error" def find_flood(elev_list, peak_list):
    peak_p = peak_list.pop(0)
    next_high = peak_p.next_high
    if not next_high:
        return None, None
    q_elev = next_high.elevation
    p_elev = peak_p.elevation

    if p_elev > q_elev:
        q_offset = next_high.loc
        p_offset = peak_p.loc
        while p_offset < len(elev_list):
            if elev_list[p_offset] == elev_list[q_offset]:
                return p_offset, q_offset
            p_offset += 1
        else:
            return None, None
    else:
        p_offset = peak_p.loc
        q_offset = elev_list.index(p_elev, p_offset+1)
        return p_offset, q_offset
    raise "Logic Error" find_flood ascending = True True ascending elev_list = list() list() elev_list class peak():
    def __init__(self, loc, elevation):
        self.loc = loc
        self.elevation = elevation
        self.next_high = None class peak():
    def __init__(self, loc, elevation):
        self.loc = loc
        self.elevation = elevation
        self.next_high = None peak q = find_flood(elev_list, peak_list) find_flood(elev_list, peak_list) q def peak_append(peak_list, loc, elevation):
    p = peak(loc, elevation)
    peak_list.append(p)
    return def peak_append(peak_list, loc, elevation):
    p = peak(loc, elevation)
    peak_list.append(p)
    return peak_append ascending = True True ascending elevation += 1 1 elevation def calc_area(p, q, elev_list):
    elev_0 = elev_list[p]
    area = 0

    prev_elev = 0
    for x in range(p, q+1):
        elev = elev_list[x] - elev_0
        area += elev

    return (abs(area)) def calc_area(p, q, elev_list):
    elev_0 = elev_list[p]
    area = 0

    prev_elev = 0
    for x in range(p, q+1):
        elev = elev_list[x] - elev_0
        area += elev

    return (abs(area)) calc_area elevation = 0 0 elevation elevation -= 1 1 elevation def adjust_peak_list(q, peak_list):
    while peak_list:
        if peak_list[0].loc >= q:
            return
        peak_list.pop(0) def adjust_peak_list(q, peak_list):
    while peak_list:
        if peak_list[0].loc >= q:
            return
        peak_list.pop(0) adjust_peak_list
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

class peak():
    def __init__(self, loc, elevation):
        self.loc = loc
        self.elevation = elevation
        self.next_high = None


def peak_append(peak_list, loc, elevation):
    p = peak(loc, elevation)
    peak_list.append(p)
    return

def peak_set_next_high(peak_list):
    next_high = peak_list[-1]   # last peak
    for i in range(len(peak_list)-2, -1, -1):
        peak_list[i].next_high = next_high
        if peak_list[i].elevation >= next_high.elevation:
            next_high = peak_list[i]


def find_flood(elev_list, peak_list):
    peak_p = peak_list.pop(0)
    next_high = peak_p.next_high
    if not next_high:
        return None, None
    q_elev = next_high.elevation
    p_elev = peak_p.elevation

    if p_elev > q_elev:
        q_offset = next_high.loc
        p_offset = peak_p.loc
        while p_offset < len(elev_list):
            if elev_list[p_offset] == elev_list[q_offset]:
                return p_offset, q_offset
            p_offset += 1
        else:
            return None, None
    else:
        p_offset = peak_p.loc
        q_offset = elev_list.index(p_elev, p_offset+1)
        return p_offset, q_offset
    raise "Logic Error"


def calc_area(p, q, elev_list):
    elev_0 = elev_list[p]
    area = 0

    prev_elev = 0
    for x in range(p, q+1):
        elev = elev_list[x] - elev_0
        area += elev

    return (abs(area))


def adjust_peak_list(q, peak_list):
    while peak_list:
        if peak_list[0].loc >= q:
            return
        peak_list.pop(0)


s = list(sys.stdin.readline().strip())

flood_area = list()
peak_list = list()

ascending = True
elevation = 0
elev_list = list()

for i in range(len(s)):
    elev_list.append(elevation)

    if s[i] == '_':
        pass
    elif s[i] == '/':
        ascending = True
        elevation += 1
    elif s[i] == '\\':
        if ascending:
            peak_append(peak_list, i, elevation)
        ascending = False
        elevation -= 1

elev_list.append(elevation)

if ascending:
    peak_append(peak_list, len(s), elevation)

peak_set_next_high(peak_list)

while peak_list:
    p, q = find_flood(elev_list, peak_list)
    if p == None:
        break
    flood_area.append(calc_area(p, q, elev_list))
    adjust_peak_list(q, peak_list)
    
print(sum(flood_area))
print(len(flood_area), end='')
for i in range(len(flood_area)):
    print(' ', flood_area[i], sep='', end='')
print()

