def main():
    s = input()
    lst1 = []
    lst2 = []
    total_area = 0

    for i in range(len(s)):
        if s[i] == "\\":
            lst1.append(i)
        elif s[i] == "/" and len(lst1) > 0:
            j = lst1.pop()
            area = i - j
            total_area += area
            while len(lst2) > 0 and lst2[-1][0] > j:
                area += lst2.pop()[1]
            lst2.append([j, area])
    print(total_area)
    print(len(lst2), *[area for j, area in lst2])


if __name__ == "__main__":
    main()
 def main():
    s = input()
    lst1 = []
    lst2 = []
    total_area = 0

    for i in range(len(s)):
        if s[i] == "\\":
            lst1.append(i)
        elif s[i] == "/" and len(lst1) > 0:
            j = lst1.pop()
            area = i - j
            total_area += area
            while len(lst2) > 0 and lst2[-1][0] > j:
                area += lst2.pop()[1]
            lst2.append([j, area])
    print(total_area)
    print(len(lst2), *[area for j, area in lst2]) main s = input() s input() input lst1 = [] lst1 [] lst2 = [] lst2 [] total_area = 0 total_area 0 for i in range(len(s)):
        if s[i] == "\\":
            lst1.append(i)
        elif s[i] == "/" and len(lst1) > 0:
            j = lst1.pop()
            area = i - j
            total_area += area
            while len(lst2) > 0 and lst2[-1][0] > j:
                area += lst2.pop()[1]
            lst2.append([j, area])
     i range(len(s)) range len(s) len s if s[i] == "\\":
            lst1.append(i)
        elif s[i] == "/" and len(lst1) > 0:
            j = lst1.pop()
            area = i - j
            total_area += area
            while len(lst2) > 0 and lst2[-1][0] > j:
                area += lst2.pop()[1]
            lst2.append([j, area])
     s[i] == "\\" s[i] s i "\\" lst1.append(i) lst1.append lst1 append i elif s[i] == "/" and len(lst1) > 0:
            j = lst1.pop()
            area = i - j
            total_area += area
            while len(lst2) > 0 and lst2[-1][0] > j:
                area += lst2.pop()[1]
            lst2.append([j, area])
     s[i] == "/" and len(lst1) > 0 s[i] == "/" s[i] s i "/" len(lst1) > 0 len(lst1) len lst1 0 j = lst1.pop() j lst1.pop() lst1.pop lst1 pop area = i - j area i - j i j total_area += area total_area area while len(lst2) > 0 and lst2[-1][0] > j:
                area += lst2.pop()[1]
             len(lst2) > 0 and lst2[-1][0] > j len(lst2) > 0 len(lst2) len lst2 0 lst2[-1][0] > j lst2[-1][0] [-1] lst2 -1 0 j area += lst2.pop()[1] area lst2.pop()[1] lst2.pop() lst2.pop lst2 pop 1 lst2.append([j, area]) lst2.append lst2 append [j, area] j area print(total_area) print total_area area for j, area in lst2 for j, area in lst2 j area lst2 for j, area in lst2 area print(len(lst2), *[area for j, area in lst2]) print len(lst2) len lst2 *[area for j, area in lst2] [area for j, area in lst2] if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    s = input()
    lst1 = []
    lst2 = []
    total_area = 0

    for i in range(len(s)):
        if s[i] == "\\":
            lst1.append(i)
        elif s[i] == "/" and len(lst1) > 0:
            j = lst1.pop()
            area = i - j
            total_area += area
            while len(lst2) > 0 and lst2[-1][0] > j:
                area += lst2.pop()[1]
            lst2.append([j, area])
    print(total_area)
    print(len(lst2), *[area for j, area in lst2]) def main():
    s = input()
    lst1 = []
    lst2 = []
    total_area = 0

    for i in range(len(s)):
        if s[i] == "\\":
            lst1.append(i)
        elif s[i] == "/" and len(lst1) > 0:
            j = lst1.pop()
            area = i - j
            total_area += area
            while len(lst2) > 0 and lst2[-1][0] > j:
                area += lst2.pop()[1]
            lst2.append([j, area])
    print(total_area)
    print(len(lst2), *[area for j, area in lst2]) main
def main():
    s = input()
    lst1 = []
    lst2 = []
    total_area = 0

    for i in range(len(s)):
        if s[i] == "\\":
            lst1.append(i)
        elif s[i] == "/" and len(lst1) > 0:
            j = lst1.pop()
            area = i - j
            total_area += area
            while len(lst2) > 0 and lst2[-1][0] > j:
                area += lst2.pop()[1]
            lst2.append([j, area])
    print(total_area)
    print(len(lst2), *[area for j, area in lst2])


if __name__ == "__main__":
    main()

