def main():
    S = input()
    stack1, stack2 = [], []
    
    sum = 0
    N = len(S)
    for i in range(N):
        if S[i] == "\\":
            stack1.append(i)
        elif S[i] == "/" and stack1:
            j = stack1.pop()
            tmp = i - j
            sum += tmp
            
            while stack2 and stack2[-1][0] > j:
                tmp += stack2.pop()[1]
            stack2.append([j, tmp])
            
    print(sum)
    print(len(stack2), *[a for j, a in stack2])
    

if __name__=="__main__":
    main() def main():
    S = input()
    stack1, stack2 = [], []
    
    sum = 0
    N = len(S)
    for i in range(N):
        if S[i] == "\\":
            stack1.append(i)
        elif S[i] == "/" and stack1:
            j = stack1.pop()
            tmp = i - j
            sum += tmp
            
            while stack2 and stack2[-1][0] > j:
                tmp += stack2.pop()[1]
            stack2.append([j, tmp])
            
    print(sum)
    print(len(stack2), *[a for j, a in stack2])
     main S = input() S input() input stack1, stack2 = [], [] stack1 [] stack2 [] sum = 0 sum 0 N = len(S) N len(S) len S for i in range(N):
        if S[i] == "\\":
            stack1.append(i)
        elif S[i] == "/" and stack1:
            j = stack1.pop()
            tmp = i - j
            sum += tmp
            
            while stack2 and stack2[-1][0] > j:
                tmp += stack2.pop()[1]
            stack2.append([j, tmp])
            
     i range(N) range N if S[i] == "\\":
            stack1.append(i)
        elif S[i] == "/" and stack1:
            j = stack1.pop()
            tmp = i - j
            sum += tmp
            
            while stack2 and stack2[-1][0] > j:
                tmp += stack2.pop()[1]
            stack2.append([j, tmp])
            
     S[i] == "\\" S[i] S i "\\" stack1.append(i) stack1.append stack1 append i elif S[i] == "/" and stack1:
            j = stack1.pop()
            tmp = i - j
            sum += tmp
            
            while stack2 and stack2[-1][0] > j:
                tmp += stack2.pop()[1]
            stack2.append([j, tmp])
            
     S[i] == "/" and stack1 S[i] == "/" S[i] S i "/" stack1 j = stack1.pop() j stack1.pop() stack1.pop stack1 pop tmp = i - j tmp i - j i j sum += tmp sum tmp while stack2 and stack2[-1][0] > j:
                tmp += stack2.pop()[1]
             stack2 and stack2[-1][0] > j stack2 stack2[-1][0] > j stack2[-1][0] [-1] stack2 -1 0 j tmp += stack2.pop()[1] tmp stack2.pop()[1] stack2.pop() stack2.pop stack2 pop 1 stack2.append([j, tmp]) stack2.append stack2 append [j, tmp] j tmp print(sum) print sum a for j, a in stack2 for j, a in stack2 j a stack2 for j, a in stack2 a print(len(stack2), *[a for j, a in stack2]) print len(stack2) len stack2 *[a for j, a in stack2] [a for j, a in stack2] if __name__=="__main__":
    main() __name__=="__main__" __name__ "__main__" main() main def main():
    S = input()
    stack1, stack2 = [], []
    
    sum = 0
    N = len(S)
    for i in range(N):
        if S[i] == "\\":
            stack1.append(i)
        elif S[i] == "/" and stack1:
            j = stack1.pop()
            tmp = i - j
            sum += tmp
            
            while stack2 and stack2[-1][0] > j:
                tmp += stack2.pop()[1]
            stack2.append([j, tmp])
            
    print(sum)
    print(len(stack2), *[a for j, a in stack2])
     def main():
    S = input()
    stack1, stack2 = [], []
    
    sum = 0
    N = len(S)
    for i in range(N):
        if S[i] == "\\":
            stack1.append(i)
        elif S[i] == "/" and stack1:
            j = stack1.pop()
            tmp = i - j
            sum += tmp
            
            while stack2 and stack2[-1][0] > j:
                tmp += stack2.pop()[1]
            stack2.append([j, tmp])
            
    print(sum)
    print(len(stack2), *[a for j, a in stack2])
     main
def main():
    S = input()
    stack1, stack2 = [], []
    
    sum = 0
    N = len(S)
    for i in range(N):
        if S[i] == "\\":
            stack1.append(i)
        elif S[i] == "/" and stack1:
            j = stack1.pop()
            tmp = i - j
            sum += tmp
            
            while stack2 and stack2[-1][0] > j:
                tmp += stack2.pop()[1]
            stack2.append([j, tmp])
            
    print(sum)
    print(len(stack2), *[a for j, a in stack2])
    

if __name__=="__main__":
    main()
