import sys
from operator import itemgetter
from collections import deque

input = sys.stdin.readline


def main():
    S = input().rstrip()

    stack = deque()
    M = []
    for i, s in enumerate(S):
        if s == "/":
            if len(stack) == 0:
                pass
            else:
                j = stack.pop()
                M.append((j, i))
        elif s == "\\":
            stack.append(i)
        else:
            pass

    M.sort(key=itemgetter(0))
    L = []
    r = -1
    for i, j in M:
        if r < i:
            r = j
            L.append(j - i)
        else:
            L[-1] += (j - i)

    A = sum(L)
    k = len(L)

    print(A)
    if k == 0:
        print(k)
    else:
        print(" ".join([str(k), " ".join(map(str, L))]))


if __name__ == "__main__":
    main()
 import sys sys from operator import itemgetter from collections import deque input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline def main():
    S = input().rstrip()

    stack = deque()
    M = []
    for i, s in enumerate(S):
        if s == "/":
            if len(stack) == 0:
                pass
            else:
                j = stack.pop()
                M.append((j, i))
        elif s == "\\":
            stack.append(i)
        else:
            pass

    M.sort(key=itemgetter(0))
    L = []
    r = -1
    for i, j in M:
        if r < i:
            r = j
            L.append(j - i)
        else:
            L[-1] += (j - i)

    A = sum(L)
    k = len(L)

    print(A)
    if k == 0:
        print(k)
    else:
        print(" ".join([str(k), " ".join(map(str, L))])) main S = input().rstrip() S input().rstrip() ().rstrip () input rstrip stack = deque() stack deque() deque M = [] M [] for i, s in enumerate(S):
        if s == "/":
            if len(stack) == 0:
                pass
            else:
                j = stack.pop()
                M.append((j, i))
        elif s == "\\":
            stack.append(i)
        else:
            pass

     i s enumerate(S) enumerate S if s == "/":
            if len(stack) == 0:
                pass
            else:
                j = stack.pop()
                M.append((j, i))
        elif s == "\\":
            stack.append(i)
        else:
            pass

     s == "/" s "/" if len(stack) == 0:
                pass
            else:
                j = stack.pop()
                M.append((j, i))
         len(stack) == 0 len(stack) len stack 0 j = stack.pop() j stack.pop() stack.pop stack pop M.append((j, i)) M.append M append (j, i) j i elif s == "\\":
            stack.append(i)
         s == "\\" s "\\" stack.append(i) stack.append stack append i M.sort(key=itemgetter(0)) M.sort M sort key=itemgetter(0) key itemgetter(0) itemgetter 0 L = [] L [] r = -1 r -1 for i, j in M:
        if r < i:
            r = j
            L.append(j - i)
        else:
            L[-1] += (j - i)

     i j M if r < i:
            r = j
            L.append(j - i)
        else:
            L[-1] += (j - i)

     r < i r i r = j r j L.append(j - i) L.append L append j - i j i L[-1] += (j - i) L[-1] L -1 j - i j i A = sum(L) A sum(L) sum L k = len(L) k len(L) len L print(A) print A if k == 0:
        print(k)
    else:
        print(" ".join([str(k), " ".join(map(str, L))])) k == 0 k 0 print(k) print k print(" ".join([str(k), " ".join(map(str, L))])) print " ".join([str(k), " ".join(map(str, L))]) " ".join " " join [str(k), " ".join(map(str, L))] str(k) str k " ".join(map(str, L)) " ".join " " join map(str, L) map str L if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    S = input().rstrip()

    stack = deque()
    M = []
    for i, s in enumerate(S):
        if s == "/":
            if len(stack) == 0:
                pass
            else:
                j = stack.pop()
                M.append((j, i))
        elif s == "\\":
            stack.append(i)
        else:
            pass

    M.sort(key=itemgetter(0))
    L = []
    r = -1
    for i, j in M:
        if r < i:
            r = j
            L.append(j - i)
        else:
            L[-1] += (j - i)

    A = sum(L)
    k = len(L)

    print(A)
    if k == 0:
        print(k)
    else:
        print(" ".join([str(k), " ".join(map(str, L))])) def main():
    S = input().rstrip()

    stack = deque()
    M = []
    for i, s in enumerate(S):
        if s == "/":
            if len(stack) == 0:
                pass
            else:
                j = stack.pop()
                M.append((j, i))
        elif s == "\\":
            stack.append(i)
        else:
            pass

    M.sort(key=itemgetter(0))
    L = []
    r = -1
    for i, j in M:
        if r < i:
            r = j
            L.append(j - i)
        else:
            L[-1] += (j - i)

    A = sum(L)
    k = len(L)

    print(A)
    if k == 0:
        print(k)
    else:
        print(" ".join([str(k), " ".join(map(str, L))])) main input = sys.stdin.readline sys.stdin.readline input
import sys
from operator import itemgetter
from collections import deque

input = sys.stdin.readline


def main():
    S = input().rstrip()

    stack = deque()
    M = []
    for i, s in enumerate(S):
        if s == "/":
            if len(stack) == 0:
                pass
            else:
                j = stack.pop()
                M.append((j, i))
        elif s == "\\":
            stack.append(i)
        else:
            pass

    M.sort(key=itemgetter(0))
    L = []
    r = -1
    for i, j in M:
        if r < i:
            r = j
            L.append(j - i)
        else:
            L[-1] += (j - i)

    A = sum(L)
    k = len(L)

    print(A)
    if k == 0:
        print(k)
    else:
        print(" ".join([str(k), " ".join(map(str, L))]))


if __name__ == "__main__":
    main()

