import sys

input = sys.stdin.readline

S = input().strip()

stack = []
ponds = []

for idx, s in enumerate(S):
    if s == "\\":
        stack.append(idx)
    elif s == "/" and stack:
        _first = stack.pop()
        pond = idx - _first
        ponds.append((_first, pond))

    # concatnate ponds
    while len(ponds) > 1:
        _cur, _size = ponds.pop()
        _prev, _prev_size = ponds.pop()

        if _cur < _prev:
            ponds.append((_cur, _prev_size + _size))
        else:
            ponds.append((_prev, _prev_size))
            ponds.append((_cur, _size))
            break

ans = []
for idx, size in ponds:
    ans.append(size)
if not ans:
    print(0)
    print(0)
else:
    print(sum(ans))
    print("{} ".format(len(ans)) + " ".join([str(s) for s in ans]))
 import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline S = input().strip() S input().strip() ().strip () input strip stack = [] stack [] ponds = [] ponds [] for idx, s in enumerate(S):
    if s == "\\":
        stack.append(idx)
    elif s == "/" and stack:
        _first = stack.pop()
        pond = idx - _first
        ponds.append((_first, pond))

    # concatnate ponds
    while len(ponds) > 1:
        _cur, _size = ponds.pop()
        _prev, _prev_size = ponds.pop()

        if _cur < _prev:
            ponds.append((_cur, _prev_size + _size))
        else:
            ponds.append((_prev, _prev_size))
            ponds.append((_cur, _size))
            break idx s enumerate(S) enumerate S if s == "\\":
        stack.append(idx)
    elif s == "/" and stack:
        _first = stack.pop()
        pond = idx - _first
        ponds.append((_first, pond))

    # concatnate ponds
     s == "\\" s "\\" stack.append(idx) stack.append stack append idx elif s == "/" and stack:
        _first = stack.pop()
        pond = idx - _first
        ponds.append((_first, pond))

    # concatnate ponds
     s == "/" and stack s == "/" s "/" stack _first = stack.pop() _first stack.pop() stack.pop stack pop pond = idx - _first pond idx - _first idx _first ponds.append((_first, pond)) ponds.append ponds append (_first, pond) _first pond while len(ponds) > 1:
        _cur, _size = ponds.pop()
        _prev, _prev_size = ponds.pop()

        if _cur < _prev:
            ponds.append((_cur, _prev_size + _size))
        else:
            ponds.append((_prev, _prev_size))
            ponds.append((_cur, _size))
            break len(ponds) > 1 len(ponds) len ponds 1 _cur, _size = ponds.pop() _cur ponds.pop() ponds.pop ponds pop _size _prev, _prev_size = ponds.pop() _prev ponds.pop() ponds.pop ponds pop _prev_size if _cur < _prev:
            ponds.append((_cur, _prev_size + _size))
        else:
            ponds.append((_prev, _prev_size))
            ponds.append((_cur, _size))
            break _cur < _prev _cur _prev ponds.append((_cur, _prev_size + _size)) ponds.append ponds append (_cur, _prev_size + _size) _cur _prev_size + _size _prev_size _size ponds.append((_prev, _prev_size)) ponds.append ponds append (_prev, _prev_size) _prev _prev_size ponds.append((_cur, _size)) ponds.append ponds append (_cur, _size) _cur _size break ans = [] ans [] for idx, size in ponds:
    ans.append(size) idx size ponds ans.append(size) ans.append ans append size if not ans:
    print(0)
    print(0)
else:
    print(sum(ans))
    print("{} ".format(len(ans)) + " ".join([str(s) for s in ans])) not ans ans print(0) print 0 print(0) print 0 print(sum(ans)) print sum(ans) sum ans str(s) for s in ans for s in ans s ans for s in ans str(s) str s print("{} ".format(len(ans)) + " ".join([str(s) for s in ans])) print "{} ".format(len(ans)) + " ".join([str(s) for s in ans]) "{} ".format(len(ans)) "{} ".format "{} " format len(ans) len ans " ".join([str(s) for s in ans]) " ".join " " join [str(s) for s in ans] stack = [] [] stack pond = idx - _first idx - _first pond _prev, _prev_size = ponds.pop() ponds.pop() _prev input = sys.stdin.readline sys.stdin.readline input ans = [] [] ans _cur, _size = ponds.pop() ponds.pop() _cur ponds = [] [] ponds _prev_size = ponds.pop() ponds.pop() _prev_size _size = ponds.pop() ponds.pop() _size S = input().strip() input().strip() S _first = stack.pop() stack.pop() _first
import sys

input = sys.stdin.readline

S = input().strip()

stack = []
ponds = []

for idx, s in enumerate(S):
    if s == "\\":
        stack.append(idx)
    elif s == "/" and stack:
        _first = stack.pop()
        pond = idx - _first
        ponds.append((_first, pond))

    # concatnate ponds
    while len(ponds) > 1:
        _cur, _size = ponds.pop()
        _prev, _prev_size = ponds.pop()

        if _cur < _prev:
            ponds.append((_cur, _prev_size + _size))
        else:
            ponds.append((_prev, _prev_size))
            ponds.append((_cur, _size))
            break

ans = []
for idx, size in ponds:
    ans.append(size)
if not ans:
    print(0)
    print(0)
else:
    print(sum(ans))
    print("{} ".format(len(ans)) + " ".join([str(s) for s in ans]))

