from collections import deque
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    inf = 10 ** 6
    s = input()
    n = len(s)
    land = [0] * (n + 1)
    for i, c in enumerate(s):
        if c == "/":
            land[i + 1] = land[i] + 1
        elif c == "_":
            land[i + 1] = land[i]
        else:
            land[i + 1] = land[i] - 1
    # print(land)

    water = [0] * (n + 1)
    w = -inf
    i = n
    for l in land[::-1]:
        if l > w: w = l
        water[i] = w
        i -= 1
    w = -inf
    for i, l in enumerate(land):
        if l > w: w = l
        water[i] = min(water[i], w)
    # print(water)

    mm = []
    sum_d = 0
    for w, l in zip(water, land):
        d = w - l
        if d == 0 and sum_d:
            mm.append(sum_d)
            sum_d = 0
        else:
            sum_d += d

    print(sum(mm))
    print(len(mm), *mm)

main()
 from collections import deque import sys sys sys.setrecursionlimit(10 ** 6) sys.setrecursionlimit sys setrecursionlimit 10 ** 6 10 6 int1 = lambda x: int(x) - 1 int1 lambda x: int(x) - 1 int(x) - 1 int(x) int x 1 x p2D = lambda x: print(*x, sep="\n") p2D lambda x: print(*x, sep="\n") print(*x, sep="\n") print *x x sep="\n" sep "\n" x def main():
    inf = 10 ** 6
    s = input()
    n = len(s)
    land = [0] * (n + 1)
    for i, c in enumerate(s):
        if c == "/":
            land[i + 1] = land[i] + 1
        elif c == "_":
            land[i + 1] = land[i]
        else:
            land[i + 1] = land[i] - 1
    # print(land)

    water = [0] * (n + 1)
    w = -inf
    i = n
    for l in land[::-1]:
        if l > w: w = l
        water[i] = w
        i -= 1
    w = -inf
    for i, l in enumerate(land):
        if l > w: w = l
        water[i] = min(water[i], w)
    # print(water)

    mm = []
    sum_d = 0
    for w, l in zip(water, land):
        d = w - l
        if d == 0 and sum_d:
            mm.append(sum_d)
            sum_d = 0
        else:
            sum_d += d

    print(sum(mm))
    print(len(mm), *mm) main inf = 10 ** 6 inf 10 ** 6 10 6 s = input() s input() input n = len(s) n len(s) len s land = [0] * (n + 1) land [0] * (n + 1) [0] 0 n + 1 n 1 for i, c in enumerate(s):
        if c == "/":
            land[i + 1] = land[i] + 1
        elif c == "_":
            land[i + 1] = land[i]
        else:
            land[i + 1] = land[i] - 1
    # print(land)

     i c enumerate(s) enumerate s if c == "/":
            land[i + 1] = land[i] + 1
        elif c == "_":
            land[i + 1] = land[i]
        else:
            land[i + 1] = land[i] - 1
    # print(land)

     c == "/" c "/" land[i + 1] = land[i] + 1 land[i + 1] land i + 1 i 1 land[i] + 1 land[i] land i 1 elif c == "_":
            land[i + 1] = land[i]
         c == "_" c "_" land[i + 1] = land[i] land[i + 1] land i + 1 i 1 land[i] land i land[i + 1] = land[i] - 1 land[i + 1] land i + 1 i 1 land[i] - 1 land[i] land i 1 water = [0] * (n + 1) water [0] * (n + 1) [0] 0 n + 1 n 1 w = -inf w -inf inf i = n i n for l in land[::-1]:
        if l > w: w = l
        water[i] = w
        i -= 1
     l land[::-1] land ::-1 -1 if l > w: w = l
         l > w l w water[i] = w water[i] water i w i -= 1 i 1 w = -inf w -inf inf for i, l in enumerate(land):
        if l > w: w = l
        water[i] = min(water[i], w)
    # print(water)

     i l enumerate(land) enumerate land if l > w: w = l
         l > w l w water[i] = min(water[i], w) water[i] water i min(water[i], w) min water[i] water i w mm = [] mm [] sum_d = 0 sum_d 0 for w, l in zip(water, land):
        d = w - l
        if d == 0 and sum_d:
            mm.append(sum_d)
            sum_d = 0
        else:
            sum_d += d

     w l zip(water, land) zip water land d = w - l d w - l w l if d == 0 and sum_d:
            mm.append(sum_d)
            sum_d = 0
        else:
            sum_d += d

     d == 0 and sum_d d == 0 d 0 sum_d mm.append(sum_d) mm.append mm append sum_d sum_d = 0 sum_d 0 sum_d += d sum_d d print(sum(mm)) print sum(mm) sum mm print(len(mm), *mm) print len(mm) len mm *mm mm main() main def main():
    inf = 10 ** 6
    s = input()
    n = len(s)
    land = [0] * (n + 1)
    for i, c in enumerate(s):
        if c == "/":
            land[i + 1] = land[i] + 1
        elif c == "_":
            land[i + 1] = land[i]
        else:
            land[i + 1] = land[i] - 1
    # print(land)

    water = [0] * (n + 1)
    w = -inf
    i = n
    for l in land[::-1]:
        if l > w: w = l
        water[i] = w
        i -= 1
    w = -inf
    for i, l in enumerate(land):
        if l > w: w = l
        water[i] = min(water[i], w)
    # print(water)

    mm = []
    sum_d = 0
    for w, l in zip(water, land):
        d = w - l
        if d == 0 and sum_d:
            mm.append(sum_d)
            sum_d = 0
        else:
            sum_d += d

    print(sum(mm))
    print(len(mm), *mm) def main():
    inf = 10 ** 6
    s = input()
    n = len(s)
    land = [0] * (n + 1)
    for i, c in enumerate(s):
        if c == "/":
            land[i + 1] = land[i] + 1
        elif c == "_":
            land[i + 1] = land[i]
        else:
            land[i + 1] = land[i] - 1
    # print(land)

    water = [0] * (n + 1)
    w = -inf
    i = n
    for l in land[::-1]:
        if l > w: w = l
        water[i] = w
        i -= 1
    w = -inf
    for i, l in enumerate(land):
        if l > w: w = l
        water[i] = min(water[i], w)
    # print(water)

    mm = []
    sum_d = 0
    for w, l in zip(water, land):
        d = w - l
        if d == 0 and sum_d:
            mm.append(sum_d)
            sum_d = 0
        else:
            sum_d += d

    print(sum(mm))
    print(len(mm), *mm) main p2D = lambda x: print(*x, sep="\n") lambda x: print(*x, sep="\n") p2D int1 = lambda x: int(x) - 1 lambda x: int(x) - 1 int1
from collections import deque
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    inf = 10 ** 6
    s = input()
    n = len(s)
    land = [0] * (n + 1)
    for i, c in enumerate(s):
        if c == "/":
            land[i + 1] = land[i] + 1
        elif c == "_":
            land[i + 1] = land[i]
        else:
            land[i + 1] = land[i] - 1
    # print(land)

    water = [0] * (n + 1)
    w = -inf
    i = n
    for l in land[::-1]:
        if l > w: w = l
        water[i] = w
        i -= 1
    w = -inf
    for i, l in enumerate(land):
        if l > w: w = l
        water[i] = min(water[i], w)
    # print(water)

    mm = []
    sum_d = 0
    for w, l in zip(water, land):
        d = w - l
        if d == 0 and sum_d:
            mm.append(sum_d)
            sum_d = 0
        else:
            sum_d += d

    print(sum(mm))
    print(len(mm), *mm)

main()

