if __name__ == '__main__':
    s1 = []
    s2 = []

    data = input()
    total_sum = 0
    for i in range(len(data)):
        if data[i] == '\\':
            s1.append(i)
        elif data[i] == '/' and len(s1) > 0:
            j = s1.pop()
            a = i - j
            total_sum += a

            while (len(s2) and s2[-1][0] > j):
                temp = s2.pop()
                a += temp[1]
            s2.append([j, a])

    print(total_sum)
    length = len(s2)
    if not length:
        print(length)
    else:
        print(length, end=' ')
    for i in range(0, length):
        endl = ' '
        if i == length - 1:
            endl = '\n'
        print(s2[i][1], end=endl)

 if __name__ == '__main__':
    s1 = []
    s2 = []

    data = input()
    total_sum = 0
    for i in range(len(data)):
        if data[i] == '\\':
            s1.append(i)
        elif data[i] == '/' and len(s1) > 0:
            j = s1.pop()
            a = i - j
            total_sum += a

            while (len(s2) and s2[-1][0] > j):
                temp = s2.pop()
                a += temp[1]
            s2.append([j, a])

    print(total_sum)
    length = len(s2)
    if not length:
        print(length)
    else:
        print(length, end=' ')
    for i in range(0, length):
        endl = ' '
        if i == length - 1:
            endl = '\n'
        print(s2[i][1], end=endl) __name__ == '__main__' __name__ '__main__' s1 = [] s1 [] s2 = [] s2 [] data = input() data input() input total_sum = 0 total_sum 0 for i in range(len(data)):
        if data[i] == '\\':
            s1.append(i)
        elif data[i] == '/' and len(s1) > 0:
            j = s1.pop()
            a = i - j
            total_sum += a

            while (len(s2) and s2[-1][0] > j):
                temp = s2.pop()
                a += temp[1]
            s2.append([j, a])

     i range(len(data)) range len(data) len data if data[i] == '\\':
            s1.append(i)
        elif data[i] == '/' and len(s1) > 0:
            j = s1.pop()
            a = i - j
            total_sum += a

            while (len(s2) and s2[-1][0] > j):
                temp = s2.pop()
                a += temp[1]
            s2.append([j, a])

     data[i] == '\\' data[i] data i '\\' s1.append(i) s1.append s1 append i elif data[i] == '/' and len(s1) > 0:
            j = s1.pop()
            a = i - j
            total_sum += a

            while (len(s2) and s2[-1][0] > j):
                temp = s2.pop()
                a += temp[1]
            s2.append([j, a])

     data[i] == '/' and len(s1) > 0 data[i] == '/' data[i] data i '/' len(s1) > 0 len(s1) len s1 0 j = s1.pop() j s1.pop() s1.pop s1 pop a = i - j a i - j i j total_sum += a total_sum a while (len(s2) and s2[-1][0] > j):
                temp = s2.pop()
                a += temp[1]
             len(s2) and s2[-1][0] > j len(s2) len s2 s2[-1][0] > j s2[-1][0] [-1] s2 -1 0 j temp = s2.pop() temp s2.pop() s2.pop s2 pop a += temp[1] a temp[1] temp 1 s2.append([j, a]) s2.append s2 append [j, a] j a print(total_sum) print total_sum length = len(s2) length len(s2) len s2 if not length:
        print(length)
    else:
        print(length, end=' ')
     not length length print(length) print length print(length, end=' ') print length end=' ' end ' ' for i in range(0, length):
        endl = ' '
        if i == length - 1:
            endl = '\n'
        print(s2[i][1], end=endl) i range(0, length) range 0 length endl = ' ' endl ' ' if i == length - 1:
            endl = '\n'
         i == length - 1 i length - 1 length 1 endl = '\n' endl '\n' print(s2[i][1], end=endl) print s2[i][1] [i] s2 i 1 end=endl end endl endl = ' ' ' ' endl s1 = [] [] s1 endl = '\n' '\n' endl j = s1.pop() s1.pop() j total_sum += a a total_sum temp = s2.pop() s2.pop() temp a += temp[1] temp[1] a total_sum = 0 0 total_sum s2 = [] [] s2 a = i - j i - j a data = input() input() data length = len(s2) len(s2) length
if __name__ == '__main__':
    s1 = []
    s2 = []

    data = input()
    total_sum = 0
    for i in range(len(data)):
        if data[i] == '\\':
            s1.append(i)
        elif data[i] == '/' and len(s1) > 0:
            j = s1.pop()
            a = i - j
            total_sum += a

            while (len(s2) and s2[-1][0] > j):
                temp = s2.pop()
                a += temp[1]
            s2.append([j, a])

    print(total_sum)
    length = len(s2)
    if not length:
        print(length)
    else:
        print(length, end=' ')
    for i in range(0, length):
        endl = ' '
        if i == length - 1:
            endl = '\n'
        print(s2[i][1], end=endl)


