import sys

class Area:
    def __init__(self, start, end, area):
        self.start = start
        self.end = end
        self.area = area
    def addArea(self, area):
        self.area += area

if __name__ == "__main__":
    line = sys.stdin.readline().strip()
    
    area_stack = []
    field_stack = []
    
    for i in range(0, len(line)):
        c = line[i]
        if (c == "\\"):
            field_stack.append((c, i))
        elif (c == "/"):
            if len(field_stack) == 0:
                continue
            cc = field_stack.pop()
            current_area = Area(cc[1], i, (i - cc[1]))
            if len(area_stack) == 0:
                area_stack.append(current_area)
                continue
            prev_area = area_stack.pop()
            flag = True
            while (prev_area.start > current_area.start) and (prev_area.end < current_area.end):
                current_area.addArea(prev_area.area)
                if len(area_stack) == 0:
                    flag = False
                    break
                prev_area = area_stack.pop()
            if flag:
                area_stack.append(prev_area)
            area_stack.append(current_area)
    print str(reduce(lambda x, y: x + y, map(lambda x: x.area, area_stack), 0))
    s = ""
    s += str(len(area_stack)) + " "
    for item in area_stack:
        s += str(item.area) + " "
    s = s.strip()
    print s import sys sys class Area:
    def __init__(self, start, end, area):
        self.start = start
        self.end = end
        self.area = area
    def addArea(self, area):
        self.area += area Area def __init__(self, start, end, area):
        self.start = start
        self.end = end
        self.area = area
     __init__ self.start = start self.start self start start self.end = end self.end self end end self.area = area self.area self area area self self start start end end area area def addArea(self, area):
        self.area += area addArea self.area += area self.area self area area self self area area if __name__ == "__main__":
    line = sys.stdin.readline().strip()
    
    area_stack = []
    field_stack = []
    
    for i in range(0, len(line)):
        c = line[i]
        if (c == "\\"):
            field_stack.append((c, i))
        elif (c == "/"):
            if len(field_stack) == 0:
                continue
            cc = field_stack.pop()
            current_area = Area(cc[1], i, (i - cc[1]))
            if len(area_stack) == 0:
                area_stack.append(current_area)
                continue
            prev_area = area_stack.pop()
            flag = True
            while (prev_area.start > current_area.start) and (prev_area.end < current_area.end):
                current_area.addArea(prev_area.area)
                if len(area_stack) == 0:
                    flag = False
                    break
                prev_area = area_stack.pop()
            if flag:
                area_stack.append(prev_area)
            area_stack.append(current_area)
    print str(reduce(lambda x, y: x + y, map(lambda x: x.area, area_stack), 0))
    s = ""
    s += str(len(area_stack)) + " "
    for item in area_stack:
        s += str(item.area) + " "
    s = s.strip()
    print s __name__ == "__main__" __name__ "__main__" line = sys.stdin.readline().strip() line sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip area_stack = [] area_stack [] field_stack = [] field_stack [] for i in range(0, len(line)):
        c = line[i]
        if (c == "\\"):
            field_stack.append((c, i))
        elif (c == "/"):
            if len(field_stack) == 0:
                continue
            cc = field_stack.pop()
            current_area = Area(cc[1], i, (i - cc[1]))
            if len(area_stack) == 0:
                area_stack.append(current_area)
                continue
            prev_area = area_stack.pop()
            flag = True
            while (prev_area.start > current_area.start) and (prev_area.end < current_area.end):
                current_area.addArea(prev_area.area)
                if len(area_stack) == 0:
                    flag = False
                    break
                prev_area = area_stack.pop()
            if flag:
                area_stack.append(prev_area)
            area_stack.append(current_area)
     i range(0, len(line)) range 0 len(line) len line c = line[i] c line[i] line i if (c == "\\"):
            field_stack.append((c, i))
        elif (c == "/"):
            if len(field_stack) == 0:
                continue
            cc = field_stack.pop()
            current_area = Area(cc[1], i, (i - cc[1]))
            if len(area_stack) == 0:
                area_stack.append(current_area)
                continue
            prev_area = area_stack.pop()
            flag = True
            while (prev_area.start > current_area.start) and (prev_area.end < current_area.end):
                current_area.addArea(prev_area.area)
                if len(area_stack) == 0:
                    flag = False
                    break
                prev_area = area_stack.pop()
            if flag:
                area_stack.append(prev_area)
            area_stack.append(current_area)
     c == "\\" c "\\" field_stack.append((c, i)) field_stack.append field_stack append (c, i) c i elif (c == "/"):
            if len(field_stack) == 0:
                continue
            cc = field_stack.pop()
            current_area = Area(cc[1], i, (i - cc[1]))
            if len(area_stack) == 0:
                area_stack.append(current_area)
                continue
            prev_area = area_stack.pop()
            flag = True
            while (prev_area.start > current_area.start) and (prev_area.end < current_area.end):
                current_area.addArea(prev_area.area)
                if len(area_stack) == 0:
                    flag = False
                    break
                prev_area = area_stack.pop()
            if flag:
                area_stack.append(prev_area)
            area_stack.append(current_area)
     c == "/" c "/" if len(field_stack) == 0:
                continue
             len(field_stack) == 0 len(field_stack) len field_stack 0 continue cc = field_stack.pop() cc field_stack.pop() field_stack.pop field_stack pop current_area = Area(cc[1], i, (i - cc[1])) current_area Area(cc[1], i, (i - cc[1])) Area cc[1] cc 1 i i - cc[1] i cc[1] cc 1 if len(area_stack) == 0:
                area_stack.append(current_area)
                continue
             len(area_stack) == 0 len(area_stack) len area_stack 0 area_stack.append(current_area) area_stack.append area_stack append current_area continue prev_area = area_stack.pop() prev_area area_stack.pop() area_stack.pop area_stack pop flag = True flag True while (prev_area.start > current_area.start) and (prev_area.end < current_area.end):
                current_area.addArea(prev_area.area)
                if len(area_stack) == 0:
                    flag = False
                    break
                prev_area = area_stack.pop()
             (prev_area.start > current_area.start) and (prev_area.end < current_area.end) prev_area.start > current_area.start prev_area.start prev_area start current_area.start current_area start prev_area.end < current_area.end prev_area.end prev_area end current_area.end current_area end current_area.addArea(prev_area.area) current_area.addArea current_area addArea prev_area.area prev_area area if len(area_stack) == 0:
                    flag = False
                    break
                 len(area_stack) == 0 len(area_stack) len area_stack 0 flag = False flag False break prev_area = area_stack.pop() prev_area area_stack.pop() area_stack.pop area_stack pop if flag:
                area_stack.append(prev_area)
             flag area_stack.append(prev_area) area_stack.append area_stack append prev_area area_stack.append(current_area) area_stack.append area_stack append current_area print str(reduce(lambda x, y: x + y, map(lambda x: x.area, area_stack), 0)) str reduce(lambda x, y: x + y, map(lambda x: x.area, area_stack), 0) reduce lambda x, y: x + y x + y x y x y map(lambda x: x.area, area_stack) map lambda x: x.area x.area x area x area_stack 0 s = "" s "" s += str(len(area_stack)) + " " s str(len(area_stack)) + " " str(len(area_stack)) str len(area_stack) len area_stack " " for item in area_stack:
        s += str(item.area) + " "
     item area_stack s += str(item.area) + " " s str(item.area) + " " str(item.area) str item.area item area " " s = s.strip() s s.strip() s.strip s strip print s += str(len(area_stack)) + " " str(len(area_stack)) + " " s class Area:
    def __init__(self, start, end, area):
        self.start = start
        self.end = end
        self.area = area
    def addArea(self, area):
        self.area += area class Area:
    def __init__(self, start, end, area):
        self.start = start
        self.end = end
        self.area = area
    def addArea(self, area):
        self.area += area Area flag = True True flag area_stack = [] [] area_stack line = sys.stdin.readline().strip() sys.stdin.readline().strip() line cc = field_stack.pop() field_stack.pop() cc s += str(item.area) + " " str(item.area) + " " s c = line[i] line[i] c current_area = Area(cc[1], i, (i - cc[1])) Area(cc[1], i, (i - cc[1])) current_area prev_area = area_stack.pop() area_stack.pop() prev_area s = "" "" s field_stack = [] [] field_stack s = s.strip() s.strip() s prev_area = area_stack.pop() area_stack.pop() prev_area flag = False False flag
import sys

class Area:
    def __init__(self, start, end, area):
        self.start = start
        self.end = end
        self.area = area
    def addArea(self, area):
        self.area += area

if __name__ == "__main__":
    line = sys.stdin.readline().strip()
    
    area_stack = []
    field_stack = []
    
    for i in range(0, len(line)):
        c = line[i]
        if (c == "\\"):
            field_stack.append((c, i))
        elif (c == "/"):
            if len(field_stack) == 0:
                continue
            cc = field_stack.pop()
            current_area = Area(cc[1], i, (i - cc[1]))
            if len(area_stack) == 0:
                area_stack.append(current_area)
                continue
            prev_area = area_stack.pop()
            flag = True
            while (prev_area.start > current_area.start) and (prev_area.end < current_area.end):
                current_area.addArea(prev_area.area)
                if len(area_stack) == 0:
                    flag = False
                    break
                prev_area = area_stack.pop()
            if flag:
                area_stack.append(prev_area)
            area_stack.append(current_area)
    print str(reduce(lambda x, y: x + y, map(lambda x: x.area, area_stack), 0))
    s = ""
    s += str(len(area_stack)) + " "
    for item in area_stack:
        s += str(item.area) + " "
    s = s.strip()
    print s