def Main():
    cross = input().replace("\n", "")

    S = list()
    V = list()
    ans = list()

    for i in range(len(cross)):
        r = cross[i]

        if r == "\\":
            S.append(i)
        elif r == "/":
            if len(S) > 0:
                j = S.pop()
                v = i - j
                V.append([v, j])

    while len(V) > 0 :
        total = 0
        [v, j] = V.pop()
        total += v

        while True:
            if len(V) > 0:
                [vv, jj] = V.pop()

                if jj > j:
                    total += vv
                else:
                    V.append([vv, jj])
                    ans.append(total)
                    break
            else:
                ans.append(total)
                break

    print("{}".format(sum(ans)))
    print(len(ans), *reversed(ans))

Main() def Main():
    cross = input().replace("\n", "")

    S = list()
    V = list()
    ans = list()

    for i in range(len(cross)):
        r = cross[i]

        if r == "\\":
            S.append(i)
        elif r == "/":
            if len(S) > 0:
                j = S.pop()
                v = i - j
                V.append([v, j])

    while len(V) > 0 :
        total = 0
        [v, j] = V.pop()
        total += v

        while True:
            if len(V) > 0:
                [vv, jj] = V.pop()

                if jj > j:
                    total += vv
                else:
                    V.append([vv, jj])
                    ans.append(total)
                    break
            else:
                ans.append(total)
                break

    print("{}".format(sum(ans)))
    print(len(ans), *reversed(ans)) Main cross = input().replace("\n", "") cross input().replace("\n", "") ().replace () input replace "\n" "" S = list() S list() list V = list() V list() list ans = list() ans list() list for i in range(len(cross)):
        r = cross[i]

        if r == "\\":
            S.append(i)
        elif r == "/":
            if len(S) > 0:
                j = S.pop()
                v = i - j
                V.append([v, j])

     i range(len(cross)) range len(cross) len cross r = cross[i] r cross[i] cross i if r == "\\":
            S.append(i)
        elif r == "/":
            if len(S) > 0:
                j = S.pop()
                v = i - j
                V.append([v, j])

     r == "\\" r "\\" S.append(i) S.append S append i elif r == "/":
            if len(S) > 0:
                j = S.pop()
                v = i - j
                V.append([v, j])

     r == "/" r "/" if len(S) > 0:
                j = S.pop()
                v = i - j
                V.append([v, j])

     len(S) > 0 len(S) len S 0 j = S.pop() j S.pop() S.pop S pop v = i - j v i - j i j V.append([v, j]) V.append V append [v, j] v j while len(V) > 0 :
        total = 0
        [v, j] = V.pop()
        total += v

        while True:
            if len(V) > 0:
                [vv, jj] = V.pop()

                if jj > j:
                    total += vv
                else:
                    V.append([vv, jj])
                    ans.append(total)
                    break
            else:
                ans.append(total)
                break

     len(V) > 0 len(V) len V 0 total = 0 total 0 [v, j] = V.pop() [v, j] v j V.pop() V.pop V pop total += v total v while True:
            if len(V) > 0:
                [vv, jj] = V.pop()

                if jj > j:
                    total += vv
                else:
                    V.append([vv, jj])
                    ans.append(total)
                    break
            else:
                ans.append(total)
                break

     True if len(V) > 0:
                [vv, jj] = V.pop()

                if jj > j:
                    total += vv
                else:
                    V.append([vv, jj])
                    ans.append(total)
                    break
            else:
                ans.append(total)
                break

     len(V) > 0 len(V) len V 0 [vv, jj] = V.pop() [vv, jj] vv jj V.pop() V.pop V pop if jj > j:
                    total += vv
                else:
                    V.append([vv, jj])
                    ans.append(total)
                    break
             jj > j jj j total += vv total vv V.append([vv, jj]) V.append V append [vv, jj] vv jj ans.append(total) ans.append ans append total break ans.append(total) ans.append ans append total break print("{}".format(sum(ans))) print "{}".format(sum(ans)) "{}".format "{}" format sum(ans) sum ans print(len(ans), *reversed(ans)) print len(ans) len ans *reversed(ans) reversed(ans) reversed ans Main() Main def Main():
    cross = input().replace("\n", "")

    S = list()
    V = list()
    ans = list()

    for i in range(len(cross)):
        r = cross[i]

        if r == "\\":
            S.append(i)
        elif r == "/":
            if len(S) > 0:
                j = S.pop()
                v = i - j
                V.append([v, j])

    while len(V) > 0 :
        total = 0
        [v, j] = V.pop()
        total += v

        while True:
            if len(V) > 0:
                [vv, jj] = V.pop()

                if jj > j:
                    total += vv
                else:
                    V.append([vv, jj])
                    ans.append(total)
                    break
            else:
                ans.append(total)
                break

    print("{}".format(sum(ans)))
    print(len(ans), *reversed(ans)) def Main():
    cross = input().replace("\n", "")

    S = list()
    V = list()
    ans = list()

    for i in range(len(cross)):
        r = cross[i]

        if r == "\\":
            S.append(i)
        elif r == "/":
            if len(S) > 0:
                j = S.pop()
                v = i - j
                V.append([v, j])

    while len(V) > 0 :
        total = 0
        [v, j] = V.pop()
        total += v

        while True:
            if len(V) > 0:
                [vv, jj] = V.pop()

                if jj > j:
                    total += vv
                else:
                    V.append([vv, jj])
                    ans.append(total)
                    break
            else:
                ans.append(total)
                break

    print("{}".format(sum(ans)))
    print(len(ans), *reversed(ans)) Main
def Main():
    cross = input().replace("\n", "")

    S = list()
    V = list()
    ans = list()

    for i in range(len(cross)):
        r = cross[i]

        if r == "\\":
            S.append(i)
        elif r == "/":
            if len(S) > 0:
                j = S.pop()
                v = i - j
                V.append([v, j])

    while len(V) > 0 :
        total = 0
        [v, j] = V.pop()
        total += v

        while True:
            if len(V) > 0:
                [vv, jj] = V.pop()

                if jj > j:
                    total += vv
                else:
                    V.append([vv, jj])
                    ans.append(total)
                    break
            else:
                ans.append(total)
                break

    print("{}".format(sum(ans)))
    print(len(ans), *reversed(ans))

Main()
