def print_puddle(puddle):
    n = len(puddle)
    if n > 0:
        print(n, end=' ')
    else:
        print(n)
    for i in range(n):
        if i != n - 1:
            print(puddle[i][1], end=' ')
        else:
            print(puddle[i][1])



def solve(A):
    left = []
    puddle = []
    sum_all = 0
    for i, a in enumerate(A):
        if a == '\\':
            left.append(i)
        elif a == '/' and len(left) > 0:
            left_i = left.pop()
            a = i - left_i
            sum_paddle = i - left_i
            sum_all += a
            while len(puddle) and puddle[-1][0] > left_i:
                tmp = puddle.pop()
                sum_paddle += tmp[1]

            puddle.append((left_i, sum_paddle))
    print(sum_all)
    print_puddle(puddle)


def main():
    A = list(input())

    solve(A)


if __name__ == "__main__":
    main()
 def print_puddle(puddle):
    n = len(puddle)
    if n > 0:
        print(n, end=' ')
    else:
        print(n)
    for i in range(n):
        if i != n - 1:
            print(puddle[i][1], end=' ')
        else:
            print(puddle[i][1]) print_puddle n = len(puddle) n len(puddle) len puddle if n > 0:
        print(n, end=' ')
    else:
        print(n)
     n > 0 n 0 print(n, end=' ') print n end=' ' end ' ' print(n) print n for i in range(n):
        if i != n - 1:
            print(puddle[i][1], end=' ')
        else:
            print(puddle[i][1]) i range(n) range n if i != n - 1:
            print(puddle[i][1], end=' ')
        else:
            print(puddle[i][1]) i != n - 1 i n - 1 n 1 print(puddle[i][1], end=' ') print puddle[i][1] [i] puddle i 1 end=' ' end ' ' print(puddle[i][1]) print puddle[i][1] [i] puddle i 1 puddle puddle def solve(A):
    left = []
    puddle = []
    sum_all = 0
    for i, a in enumerate(A):
        if a == '\\':
            left.append(i)
        elif a == '/' and len(left) > 0:
            left_i = left.pop()
            a = i - left_i
            sum_paddle = i - left_i
            sum_all += a
            while len(puddle) and puddle[-1][0] > left_i:
                tmp = puddle.pop()
                sum_paddle += tmp[1]

            puddle.append((left_i, sum_paddle))
    print(sum_all)
    print_puddle(puddle) solve left = [] left [] puddle = [] puddle [] sum_all = 0 sum_all 0 for i, a in enumerate(A):
        if a == '\\':
            left.append(i)
        elif a == '/' and len(left) > 0:
            left_i = left.pop()
            a = i - left_i
            sum_paddle = i - left_i
            sum_all += a
            while len(puddle) and puddle[-1][0] > left_i:
                tmp = puddle.pop()
                sum_paddle += tmp[1]

            puddle.append((left_i, sum_paddle))
     i a enumerate(A) enumerate A if a == '\\':
            left.append(i)
        elif a == '/' and len(left) > 0:
            left_i = left.pop()
            a = i - left_i
            sum_paddle = i - left_i
            sum_all += a
            while len(puddle) and puddle[-1][0] > left_i:
                tmp = puddle.pop()
                sum_paddle += tmp[1]

            puddle.append((left_i, sum_paddle))
     a == '\\' a '\\' left.append(i) left.append left append i elif a == '/' and len(left) > 0:
            left_i = left.pop()
            a = i - left_i
            sum_paddle = i - left_i
            sum_all += a
            while len(puddle) and puddle[-1][0] > left_i:
                tmp = puddle.pop()
                sum_paddle += tmp[1]

            puddle.append((left_i, sum_paddle))
     a == '/' and len(left) > 0 a == '/' a '/' len(left) > 0 len(left) len left 0 left_i = left.pop() left_i left.pop() left.pop left pop a = i - left_i a i - left_i i left_i sum_paddle = i - left_i sum_paddle i - left_i i left_i sum_all += a sum_all a while len(puddle) and puddle[-1][0] > left_i:
                tmp = puddle.pop()
                sum_paddle += tmp[1]

             len(puddle) and puddle[-1][0] > left_i len(puddle) len puddle puddle[-1][0] > left_i puddle[-1][0] [-1] puddle -1 0 left_i tmp = puddle.pop() tmp puddle.pop() puddle.pop puddle pop sum_paddle += tmp[1] sum_paddle tmp[1] tmp 1 puddle.append((left_i, sum_paddle)) puddle.append puddle append (left_i, sum_paddle) left_i sum_paddle print(sum_all) print sum_all print_puddle(puddle) print_puddle puddle A A def main():
    A = list(input())

    solve(A) main A = list(input()) A list(input()) list input() input solve(A) solve A if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def print_puddle(puddle):
    n = len(puddle)
    if n > 0:
        print(n, end=' ')
    else:
        print(n)
    for i in range(n):
        if i != n - 1:
            print(puddle[i][1], end=' ')
        else:
            print(puddle[i][1]) def print_puddle(puddle):
    n = len(puddle)
    if n > 0:
        print(n, end=' ')
    else:
        print(n)
    for i in range(n):
        if i != n - 1:
            print(puddle[i][1], end=' ')
        else:
            print(puddle[i][1]) print_puddle def main():
    A = list(input())

    solve(A) def main():
    A = list(input())

    solve(A) main def solve(A):
    left = []
    puddle = []
    sum_all = 0
    for i, a in enumerate(A):
        if a == '\\':
            left.append(i)
        elif a == '/' and len(left) > 0:
            left_i = left.pop()
            a = i - left_i
            sum_paddle = i - left_i
            sum_all += a
            while len(puddle) and puddle[-1][0] > left_i:
                tmp = puddle.pop()
                sum_paddle += tmp[1]

            puddle.append((left_i, sum_paddle))
    print(sum_all)
    print_puddle(puddle) def solve(A):
    left = []
    puddle = []
    sum_all = 0
    for i, a in enumerate(A):
        if a == '\\':
            left.append(i)
        elif a == '/' and len(left) > 0:
            left_i = left.pop()
            a = i - left_i
            sum_paddle = i - left_i
            sum_all += a
            while len(puddle) and puddle[-1][0] > left_i:
                tmp = puddle.pop()
                sum_paddle += tmp[1]

            puddle.append((left_i, sum_paddle))
    print(sum_all)
    print_puddle(puddle) solve
def print_puddle(puddle):
    n = len(puddle)
    if n > 0:
        print(n, end=' ')
    else:
        print(n)
    for i in range(n):
        if i != n - 1:
            print(puddle[i][1], end=' ')
        else:
            print(puddle[i][1])



def solve(A):
    left = []
    puddle = []
    sum_all = 0
    for i, a in enumerate(A):
        if a == '\\':
            left.append(i)
        elif a == '/' and len(left) > 0:
            left_i = left.pop()
            a = i - left_i
            sum_paddle = i - left_i
            sum_all += a
            while len(puddle) and puddle[-1][0] > left_i:
                tmp = puddle.pop()
                sum_paddle += tmp[1]

            puddle.append((left_i, sum_paddle))
    print(sum_all)
    print_puddle(puddle)


def main():
    A = list(input())

    solve(A)


if __name__ == "__main__":
    main()

