from collections import deque

s = input()

d = deque()
l = deque()


def calc_area(j, i):
    return i - j


for i, c in enumerate(s):
    if c == "\\":
        d.append(i)
    if c == "/":
        if len(d) == 0:
            continue

        j = d.pop()

        s = calc_area(j, i)
        while len(l) > 0:
            _j, _i, _s = l.pop()
            if j < _j:
                s += _s
            else:
                l.append((_j, _i, _s))
                break

        l.append((j, i, s))

ans = str(len(l))
sum_area = 0
for j, i, s in l:
    ans += " " + str(s)
    sum_area += s

print(sum_area)
print(ans) from collections import deque s = input() s input() input d = deque() d deque() deque l = deque() l deque() deque def calc_area(j, i):
    return i - j calc_area return i - j i - j i j j j i i for i, c in enumerate(s):
    if c == "\\":
        d.append(i)
    if c == "/":
        if len(d) == 0:
            continue

        j = d.pop()

        s = calc_area(j, i)
        while len(l) > 0:
            _j, _i, _s = l.pop()
            if j < _j:
                s += _s
            else:
                l.append((_j, _i, _s))
                break

        l.append((j, i, s)) i c enumerate(s) enumerate s if c == "\\":
        d.append(i)
     c == "\\" c "\\" d.append(i) d.append d append i if c == "/":
        if len(d) == 0:
            continue

        j = d.pop()

        s = calc_area(j, i)
        while len(l) > 0:
            _j, _i, _s = l.pop()
            if j < _j:
                s += _s
            else:
                l.append((_j, _i, _s))
                break

        l.append((j, i, s)) c == "/" c "/" if len(d) == 0:
            continue

         len(d) == 0 len(d) len d 0 continue j = d.pop() j d.pop() d.pop d pop s = calc_area(j, i) s calc_area(j, i) calc_area j i while len(l) > 0:
            _j, _i, _s = l.pop()
            if j < _j:
                s += _s
            else:
                l.append((_j, _i, _s))
                break

         len(l) > 0 len(l) len l 0 _j, _i, _s = l.pop() _j l.pop() l.pop l pop _i _s if j < _j:
                s += _s
            else:
                l.append((_j, _i, _s))
                break

         j < _j j _j s += _s s _s l.append((_j, _i, _s)) l.append l append (_j, _i, _s) _j _i _s break l.append((j, i, s)) l.append l append (j, i, s) j i s ans = str(len(l)) ans str(len(l)) str len(l) len l sum_area = 0 sum_area 0 for j, i, s in l:
    ans += " " + str(s)
    sum_area += s j i s l ans += " " + str(s) ans " " + str(s) " " str(s) str s sum_area += s sum_area s print(sum_area) print sum_area print(ans) print ans j = d.pop() d.pop() j s = input() input() s _i, _s = l.pop() l.pop() _i d = deque() deque() d l = deque() deque() l def calc_area(j, i):
    return i - j def calc_area(j, i):
    return i - j calc_area s = calc_area(j, i) calc_area(j, i) s sum_area += s s sum_area s += _s _s s ans += " " + str(s) " " + str(s) ans _s = l.pop() l.pop() _s ans = str(len(l)) str(len(l)) ans sum_area = 0 0 sum_area _j, _i, _s = l.pop() l.pop() _j
from collections import deque

s = input()

d = deque()
l = deque()


def calc_area(j, i):
    return i - j


for i, c in enumerate(s):
    if c == "\\":
        d.append(i)
    if c == "/":
        if len(d) == 0:
            continue

        j = d.pop()

        s = calc_area(j, i)
        while len(l) > 0:
            _j, _i, _s = l.pop()
            if j < _j:
                s += _s
            else:
                l.append((_j, _i, _s))
                break

        l.append((j, i, s))

ans = str(len(l))
sum_area = 0
for j, i, s in l:
    ans += " " + str(s)
    sum_area += s

print(sum_area)
print(ans)