import sys
import math
import copy
from typing import Tuple, List, Union
input = sys.stdin.readline

class Area:
    def __init__(self, startidx: int, area: int):
        self.startidx = startidx
        self.area = area
    def __repr__(self):
        return "{}".format(self.area)


def main():
    edgeStack = []
    areaStack = []
    line = input()
    for idx, item in enumerate(line):
        if item is "\\":
            edgeStack.append(idx)
        elif item is "_":
            pass
        elif item is "/":
            if len(edgeStack) < 1:
                continue
            prevarea = 0
            previdx = edgeStack[-1]
            while (len(areaStack) > 0
                   and len(edgeStack) > 0
                   and areaStack[-1].startidx > edgeStack[-1]):
                area = areaStack.pop(-1)
                prevarea += area.area
            areaStack.append(Area(edgeStack.pop(-1), prevarea + idx - previdx))
    return areaStack


if __name__ == '__main__':
    areaStack = main()
    print(sum([area.area for area in areaStack]))
    if len(areaStack):
        print(len(areaStack), end=" ")
    else:
        print(len(areaStack), end="")
    print(" ".join([str(area) for area in areaStack]))
 import sys sys import math math import copy copy from typing import Tuple, List, Union input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline class Area:
    def __init__(self, startidx: int, area: int):
        self.startidx = startidx
        self.area = area
    def __repr__(self):
        return "{}".format(self.area) Area def __init__(self, startidx: int, area: int):
        self.startidx = startidx
        self.area = area
     __init__ self.startidx = startidx self.startidx self startidx startidx self.area = area self.area self area area self self startidx: int startidx area: int area def __repr__(self):
        return "{}".format(self.area) __repr__ return "{}".format(self.area) "{}".format(self.area) "{}".format "{}" format self.area self area self self def main():
    edgeStack = []
    areaStack = []
    line = input()
    for idx, item in enumerate(line):
        if item is "\\":
            edgeStack.append(idx)
        elif item is "_":
            pass
        elif item is "/":
            if len(edgeStack) < 1:
                continue
            prevarea = 0
            previdx = edgeStack[-1]
            while (len(areaStack) > 0
                   and len(edgeStack) > 0
                   and areaStack[-1].startidx > edgeStack[-1]):
                area = areaStack.pop(-1)
                prevarea += area.area
            areaStack.append(Area(edgeStack.pop(-1), prevarea + idx - previdx))
    return areaStack main edgeStack = [] edgeStack [] areaStack = [] areaStack [] line = input() line input() input for idx, item in enumerate(line):
        if item is "\\":
            edgeStack.append(idx)
        elif item is "_":
            pass
        elif item is "/":
            if len(edgeStack) < 1:
                continue
            prevarea = 0
            previdx = edgeStack[-1]
            while (len(areaStack) > 0
                   and len(edgeStack) > 0
                   and areaStack[-1].startidx > edgeStack[-1]):
                area = areaStack.pop(-1)
                prevarea += area.area
            areaStack.append(Area(edgeStack.pop(-1), prevarea + idx - previdx))
     idx item enumerate(line) enumerate line if item is "\\":
            edgeStack.append(idx)
        elif item is "_":
            pass
        elif item is "/":
            if len(edgeStack) < 1:
                continue
            prevarea = 0
            previdx = edgeStack[-1]
            while (len(areaStack) > 0
                   and len(edgeStack) > 0
                   and areaStack[-1].startidx > edgeStack[-1]):
                area = areaStack.pop(-1)
                prevarea += area.area
            areaStack.append(Area(edgeStack.pop(-1), prevarea + idx - previdx))
     item is "\\" item "\\" edgeStack.append(idx) edgeStack.append edgeStack append idx elif item is "_":
            pass
         item is "_" item "_" elif item is "/":
            if len(edgeStack) < 1:
                continue
            prevarea = 0
            previdx = edgeStack[-1]
            while (len(areaStack) > 0
                   and len(edgeStack) > 0
                   and areaStack[-1].startidx > edgeStack[-1]):
                area = areaStack.pop(-1)
                prevarea += area.area
            areaStack.append(Area(edgeStack.pop(-1), prevarea + idx - previdx))
     item is "/" item "/" if len(edgeStack) < 1:
                continue
             len(edgeStack) < 1 len(edgeStack) len edgeStack 1 continue prevarea = 0 prevarea 0 previdx = edgeStack[-1] previdx edgeStack[-1] edgeStack -1 while (len(areaStack) > 0
                   and len(edgeStack) > 0
                   and areaStack[-1].startidx > edgeStack[-1]):
                area = areaStack.pop(-1)
                prevarea += area.area
             len(areaStack) > 0
                   and len(edgeStack) > 0
                   and areaStack[-1].startidx > edgeStack[-1] len(areaStack) > 0
                   and len(edgeStack) > 0 len(areaStack) > 0 len(areaStack) len areaStack 0 len(edgeStack) > 0 len(edgeStack) len edgeStack 0 areaStack[-1].startidx > edgeStack[-1] areaStack[-1].startidx [-1] areaStack -1 startidx edgeStack[-1] edgeStack -1 area = areaStack.pop(-1) area areaStack.pop(-1) areaStack.pop areaStack pop -1 prevarea += area.area prevarea area.area area area areaStack.append(Area(edgeStack.pop(-1), prevarea + idx - previdx)) areaStack.append areaStack append Area(edgeStack.pop(-1), prevarea + idx - previdx) Area edgeStack.pop(-1) edgeStack.pop edgeStack pop -1 prevarea + idx - previdx prevarea + idx prevarea idx previdx return areaStack areaStack if __name__ == '__main__':
    areaStack = main()
    print(sum([area.area for area in areaStack]))
    if len(areaStack):
        print(len(areaStack), end=" ")
    else:
        print(len(areaStack), end="")
    print(" ".join([str(area) for area in areaStack])) __name__ == '__main__' __name__ '__main__' areaStack = main() areaStack main() main area.area for area in areaStack for area in areaStack area areaStack for area in areaStack area.area area area print(sum([area.area for area in areaStack])) print sum([area.area for area in areaStack]) sum [area.area for area in areaStack] if len(areaStack):
        print(len(areaStack), end=" ")
    else:
        print(len(areaStack), end="")
     len(areaStack) len areaStack print(len(areaStack), end=" ") print len(areaStack) len areaStack end=" " end " " print(len(areaStack), end="") print len(areaStack) len areaStack end="" end "" str(area) for area in areaStack for area in areaStack area areaStack for area in areaStack str(area) str area print(" ".join([str(area) for area in areaStack])) print " ".join([str(area) for area in areaStack]) " ".join " " join [str(area) for area in areaStack] def main():
    edgeStack = []
    areaStack = []
    line = input()
    for idx, item in enumerate(line):
        if item is "\\":
            edgeStack.append(idx)
        elif item is "_":
            pass
        elif item is "/":
            if len(edgeStack) < 1:
                continue
            prevarea = 0
            previdx = edgeStack[-1]
            while (len(areaStack) > 0
                   and len(edgeStack) > 0
                   and areaStack[-1].startidx > edgeStack[-1]):
                area = areaStack.pop(-1)
                prevarea += area.area
            areaStack.append(Area(edgeStack.pop(-1), prevarea + idx - previdx))
    return areaStack def main():
    edgeStack = []
    areaStack = []
    line = input()
    for idx, item in enumerate(line):
        if item is "\\":
            edgeStack.append(idx)
        elif item is "_":
            pass
        elif item is "/":
            if len(edgeStack) < 1:
                continue
            prevarea = 0
            previdx = edgeStack[-1]
            while (len(areaStack) > 0
                   and len(edgeStack) > 0
                   and areaStack[-1].startidx > edgeStack[-1]):
                area = areaStack.pop(-1)
                prevarea += area.area
            areaStack.append(Area(edgeStack.pop(-1), prevarea + idx - previdx))
    return areaStack main areaStack = main() main() areaStack class Area:
    def __init__(self, startidx: int, area: int):
        self.startidx = startidx
        self.area = area
    def __repr__(self):
        return "{}".format(self.area) class Area:
    def __init__(self, startidx: int, area: int):
        self.startidx = startidx
        self.area = area
    def __repr__(self):
        return "{}".format(self.area) Area input = sys.stdin.readline sys.stdin.readline input
import sys
import math
import copy
from typing import Tuple, List, Union
input = sys.stdin.readline

class Area:
    def __init__(self, startidx: int, area: int):
        self.startidx = startidx
        self.area = area
    def __repr__(self):
        return "{}".format(self.area)


def main():
    edgeStack = []
    areaStack = []
    line = input()
    for idx, item in enumerate(line):
        if item is "\\":
            edgeStack.append(idx)
        elif item is "_":
            pass
        elif item is "/":
            if len(edgeStack) < 1:
                continue
            prevarea = 0
            previdx = edgeStack[-1]
            while (len(areaStack) > 0
                   and len(edgeStack) > 0
                   and areaStack[-1].startidx > edgeStack[-1]):
                area = areaStack.pop(-1)
                prevarea += area.area
            areaStack.append(Area(edgeStack.pop(-1), prevarea + idx - previdx))
    return areaStack


if __name__ == '__main__':
    areaStack = main()
    print(sum([area.area for area in areaStack]))
    if len(areaStack):
        print(len(areaStack), end=" ")
    else:
        print(len(areaStack), end="")
    print(" ".join([str(area) for area in areaStack]))

