if __name__ == '__main__':
    from collections import deque
    str = input()
    stack1,stack2 = deque([]),deque([])
    sum = 0

    for i in range(len(str)):
        if str[i] == '\\':
            stack1.append(i)
        elif str[i] == '/':
            if stack1 != deque([]):
                x = stack1.pop()
                stack2.append([x,i-x])

        while len(stack2) >= 2 and stack2[len(stack2) - 2][0] > stack2[len(stack2) - 1][0]:
            a = stack2.pop()
            b = stack2.pop()
            stack2.append([a[0],a[1]+b[1]])

    #全面積算出、出力
    for i in range(len(stack2)):
        sum += stack2[i][1]
    print(sum)
    if len(stack2) > 0:
        print(len(stack2),end = " ")
    else:
        print(len(stack2))
    for i in range(len(stack2)):
        if i == len(stack2) - 1:
            print(stack2[i][1])
        else:
            print(stack2[i][1],end = " ")
 if __name__ == '__main__':
    from collections import deque
    str = input()
    stack1,stack2 = deque([]),deque([])
    sum = 0

    for i in range(len(str)):
        if str[i] == '\\':
            stack1.append(i)
        elif str[i] == '/':
            if stack1 != deque([]):
                x = stack1.pop()
                stack2.append([x,i-x])

        while len(stack2) >= 2 and stack2[len(stack2) - 2][0] > stack2[len(stack2) - 1][0]:
            a = stack2.pop()
            b = stack2.pop()
            stack2.append([a[0],a[1]+b[1]])

    #全面積算出、出力
    for i in range(len(stack2)):
        sum += stack2[i][1]
    print(sum)
    if len(stack2) > 0:
        print(len(stack2),end = " ")
    else:
        print(len(stack2))
    for i in range(len(stack2)):
        if i == len(stack2) - 1:
            print(stack2[i][1])
        else:
            print(stack2[i][1],end = " ") __name__ == '__main__' __name__ '__main__' from collections import deque str = input() str input() input stack1,stack2 = deque([]),deque([]) stack1 deque([]) deque [] stack2 deque([]) deque [] sum = 0 sum 0 for i in range(len(str)):
        if str[i] == '\\':
            stack1.append(i)
        elif str[i] == '/':
            if stack1 != deque([]):
                x = stack1.pop()
                stack2.append([x,i-x])

        while len(stack2) >= 2 and stack2[len(stack2) - 2][0] > stack2[len(stack2) - 1][0]:
            a = stack2.pop()
            b = stack2.pop()
            stack2.append([a[0],a[1]+b[1]])

    #全面積算出、出力
     i range(len(str)) range len(str) len str if str[i] == '\\':
            stack1.append(i)
        elif str[i] == '/':
            if stack1 != deque([]):
                x = stack1.pop()
                stack2.append([x,i-x])

         str[i] == '\\' str[i] str i '\\' stack1.append(i) stack1.append stack1 append i elif str[i] == '/':
            if stack1 != deque([]):
                x = stack1.pop()
                stack2.append([x,i-x])

         str[i] == '/' str[i] str i '/' if stack1 != deque([]):
                x = stack1.pop()
                stack2.append([x,i-x])

         stack1 != deque([]) stack1 deque([]) deque [] x = stack1.pop() x stack1.pop() stack1.pop stack1 pop stack2.append([x,i-x]) stack2.append stack2 append [x,i-x] x i-x i x while len(stack2) >= 2 and stack2[len(stack2) - 2][0] > stack2[len(stack2) - 1][0]:
            a = stack2.pop()
            b = stack2.pop()
            stack2.append([a[0],a[1]+b[1]])

    #全面積算出、出力
     len(stack2) >= 2 and stack2[len(stack2) - 2][0] > stack2[len(stack2) - 1][0] len(stack2) >= 2 len(stack2) len stack2 2 stack2[len(stack2) - 2][0] > stack2[len(stack2) - 1][0] stack2[len(stack2) - 2][0] [len(stack2) - 2] stack2 len(stack2) - 2 len(stack2) len stack2 2 0 stack2[len(stack2) - 1][0] [len(stack2) - 1] stack2 len(stack2) - 1 len(stack2) len stack2 1 0 a = stack2.pop() a stack2.pop() stack2.pop stack2 pop b = stack2.pop() b stack2.pop() stack2.pop stack2 pop stack2.append([a[0],a[1]+b[1]]) stack2.append stack2 append [a[0],a[1]+b[1]] a[0] a 0 a[1]+b[1] a[1] a 1 b[1] b 1 for i in range(len(stack2)):
        sum += stack2[i][1]
     i range(len(stack2)) range len(stack2) len stack2 sum += stack2[i][1] sum stack2[i][1] [i] stack2 i 1 print(sum) print sum if len(stack2) > 0:
        print(len(stack2),end = " ")
    else:
        print(len(stack2))
     len(stack2) > 0 len(stack2) len stack2 0 print(len(stack2),end = " ") print len(stack2) len stack2 end = " " end " " print(len(stack2)) print len(stack2) len stack2 for i in range(len(stack2)):
        if i == len(stack2) - 1:
            print(stack2[i][1])
        else:
            print(stack2[i][1],end = " ") i range(len(stack2)) range len(stack2) len stack2 if i == len(stack2) - 1:
            print(stack2[i][1])
        else:
            print(stack2[i][1],end = " ") i == len(stack2) - 1 i len(stack2) - 1 len(stack2) len stack2 1 print(stack2[i][1]) print stack2[i][1] [i] stack2 i 1 print(stack2[i][1],end = " ") print stack2[i][1] [i] stack2 i 1 end = " " end " " a = stack2.pop() stack2.pop() a sum = 0 0 sum stack1,stack2 = deque([]),deque([]) deque([]) stack1 b = stack2.pop() stack2.pop() b str = input() input() str stack2 = deque([]),deque([]) deque([]) stack2 sum += stack2[i][1] stack2[i][1] sum x = stack1.pop() stack1.pop() x
if __name__ == '__main__':
    from collections import deque
    str = input()
    stack1,stack2 = deque([]),deque([])
    sum = 0

    for i in range(len(str)):
        if str[i] == '\\':
            stack1.append(i)
        elif str[i] == '/':
            if stack1 != deque([]):
                x = stack1.pop()
                stack2.append([x,i-x])

        while len(stack2) >= 2 and stack2[len(stack2) - 2][0] > stack2[len(stack2) - 1][0]:
            a = stack2.pop()
            b = stack2.pop()
            stack2.append([a[0],a[1]+b[1]])

    #全面積算出、出力
    for i in range(len(stack2)):
        sum += stack2[i][1]
    print(sum)
    if len(stack2) > 0:
        print(len(stack2),end = " ")
    else:
        print(len(stack2))
    for i in range(len(stack2)):
        if i == len(stack2) - 1:
            print(stack2[i][1])
        else:
            print(stack2[i][1],end = " ")

