def main():
    """ ????????? """
    S1 = [] # ????????????1(??????????????????)
    S2 = [] # ????????????2(??????????°´????????????????????¨??¢???)
    A = 0 # ?????¢???

    inp = input()
    #inp = "\\\\///\\_/\\/\\\\\\\\/_/\\\\///__\\\\\\_\\\\/_\\/_/\\"
    for i in range(len(inp)):
        if inp[i] == chr(0x5c): # \ 
            S1.append(i)
            S2.append([i,0])
        elif inp[i] == chr(0x2f): # /
            if len(S1):
                j = S1.pop()
                d = i - j
                A += d
                k = d
                while len(S2):
                    p = S2.pop()
                    if p[1] > 0:
                        k += p[1]
                    else:
                        S2.append([p[0],k])
                        break
        #print("[{}] {} A={} S1:{} S2:{}".format(i,inp[i],A,S1,S2))
    L = []
    for p in S2:
        if p[1] > 0:
            L.append(p[1])
    print(A)
    if A > 0:
        print("{} {}".format(len(L)," ".join(map(str,L))))
    else:
        print("0")


if __name__ == '__main__':
    main() def main():
    """ ????????? """
    S1 = [] # ????????????1(??????????????????)
    S2 = [] # ????????????2(??????????°´????????????????????¨??¢???)
    A = 0 # ?????¢???

    inp = input()
    #inp = "\\\\///\\_/\\/\\\\\\\\/_/\\\\///__\\\\\\_\\\\/_\\/_/\\"
    for i in range(len(inp)):
        if inp[i] == chr(0x5c): # \ 
            S1.append(i)
            S2.append([i,0])
        elif inp[i] == chr(0x2f): # /
            if len(S1):
                j = S1.pop()
                d = i - j
                A += d
                k = d
                while len(S2):
                    p = S2.pop()
                    if p[1] > 0:
                        k += p[1]
                    else:
                        S2.append([p[0],k])
                        break
        #print("[{}] {} A={} S1:{} S2:{}".format(i,inp[i],A,S1,S2))
    L = []
    for p in S2:
        if p[1] > 0:
            L.append(p[1])
    print(A)
    if A > 0:
        print("{} {}".format(len(L)," ".join(map(str,L))))
    else:
        print("0") main """ ????????? """ S1 = [] S1 [] S2 = [] S2 [] A = 0 A 0 inp = input() inp input() input for i in range(len(inp)):
        if inp[i] == chr(0x5c): # \ 
            S1.append(i)
            S2.append([i,0])
        elif inp[i] == chr(0x2f): # /
            if len(S1):
                j = S1.pop()
                d = i - j
                A += d
                k = d
                while len(S2):
                    p = S2.pop()
                    if p[1] > 0:
                        k += p[1]
                    else:
                        S2.append([p[0],k])
                        break
        #print("[{}] {} A={} S1:{} S2:{}".format(i,inp[i],A,S1,S2))
     i range(len(inp)) range len(inp) len inp if inp[i] == chr(0x5c): # \ 
            S1.append(i)
            S2.append([i,0])
        elif inp[i] == chr(0x2f): # /
            if len(S1):
                j = S1.pop()
                d = i - j
                A += d
                k = d
                while len(S2):
                    p = S2.pop()
                    if p[1] > 0:
                        k += p[1]
                    else:
                        S2.append([p[0],k])
                        break
        #print("[{}] {} A={} S1:{} S2:{}".format(i,inp[i],A,S1,S2))
     inp[i] == chr(0x5c) inp[i] inp i chr(0x5c) chr 0x5c S1.append(i) S1.append S1 append i S2.append([i,0]) S2.append S2 append [i,0] i 0 elif inp[i] == chr(0x2f): # /
            if len(S1):
                j = S1.pop()
                d = i - j
                A += d
                k = d
                while len(S2):
                    p = S2.pop()
                    if p[1] > 0:
                        k += p[1]
                    else:
                        S2.append([p[0],k])
                        break
        #print("[{}] {} A={} S1:{} S2:{}".format(i,inp[i],A,S1,S2))
     inp[i] == chr(0x2f) inp[i] inp i chr(0x2f) chr 0x2f if len(S1):
                j = S1.pop()
                d = i - j
                A += d
                k = d
                while len(S2):
                    p = S2.pop()
                    if p[1] > 0:
                        k += p[1]
                    else:
                        S2.append([p[0],k])
                        break
        #print("[{}] {} A={} S1:{} S2:{}".format(i,inp[i],A,S1,S2))
     len(S1) len S1 j = S1.pop() j S1.pop() S1.pop S1 pop d = i - j d i - j i j A += d A d k = d k d while len(S2):
                    p = S2.pop()
                    if p[1] > 0:
                        k += p[1]
                    else:
                        S2.append([p[0],k])
                        break
        #print("[{}] {} A={} S1:{} S2:{}".format(i,inp[i],A,S1,S2))
     len(S2) len S2 p = S2.pop() p S2.pop() S2.pop S2 pop if p[1] > 0:
                        k += p[1]
                    else:
                        S2.append([p[0],k])
                        break
        #print("[{}] {} A={} S1:{} S2:{}".format(i,inp[i],A,S1,S2))
     p[1] > 0 p[1] p 1 0 k += p[1] k p[1] p 1 S2.append([p[0],k]) S2.append S2 append [p[0],k] p[0] p 0 k break L = [] L [] for p in S2:
        if p[1] > 0:
            L.append(p[1])
     p S2 if p[1] > 0:
            L.append(p[1])
     p[1] > 0 p[1] p 1 0 L.append(p[1]) L.append L append p[1] p 1 print(A) print A if A > 0:
        print("{} {}".format(len(L)," ".join(map(str,L))))
    else:
        print("0") A > 0 A 0 print("{} {}".format(len(L)," ".join(map(str,L)))) print "{} {}".format(len(L)," ".join(map(str,L))) "{} {}".format "{} {}" format len(L) len L " ".join(map(str,L)) " ".join " " join map(str,L) map str L print("0") print "0" if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    """ ????????? """
    S1 = [] # ????????????1(??????????????????)
    S2 = [] # ????????????2(??????????°´????????????????????¨??¢???)
    A = 0 # ?????¢???

    inp = input()
    #inp = "\\\\///\\_/\\/\\\\\\\\/_/\\\\///__\\\\\\_\\\\/_\\/_/\\"
    for i in range(len(inp)):
        if inp[i] == chr(0x5c): # \ 
            S1.append(i)
            S2.append([i,0])
        elif inp[i] == chr(0x2f): # /
            if len(S1):
                j = S1.pop()
                d = i - j
                A += d
                k = d
                while len(S2):
                    p = S2.pop()
                    if p[1] > 0:
                        k += p[1]
                    else:
                        S2.append([p[0],k])
                        break
        #print("[{}] {} A={} S1:{} S2:{}".format(i,inp[i],A,S1,S2))
    L = []
    for p in S2:
        if p[1] > 0:
            L.append(p[1])
    print(A)
    if A > 0:
        print("{} {}".format(len(L)," ".join(map(str,L))))
    else:
        print("0") def main():
    """ ????????? """
    S1 = [] # ????????????1(??????????????????)
    S2 = [] # ????????????2(??????????°´????????????????????¨??¢???)
    A = 0 # ?????¢???

    inp = input()
    #inp = "\\\\///\\_/\\/\\\\\\\\/_/\\\\///__\\\\\\_\\\\/_\\/_/\\"
    for i in range(len(inp)):
        if inp[i] == chr(0x5c): # \ 
            S1.append(i)
            S2.append([i,0])
        elif inp[i] == chr(0x2f): # /
            if len(S1):
                j = S1.pop()
                d = i - j
                A += d
                k = d
                while len(S2):
                    p = S2.pop()
                    if p[1] > 0:
                        k += p[1]
                    else:
                        S2.append([p[0],k])
                        break
        #print("[{}] {} A={} S1:{} S2:{}".format(i,inp[i],A,S1,S2))
    L = []
    for p in S2:
        if p[1] > 0:
            L.append(p[1])
    print(A)
    if A > 0:
        print("{} {}".format(len(L)," ".join(map(str,L))))
    else:
        print("0") main
def main():
    """ ????????? """
    S1 = [] # ????????????1(??????????????????)
    S2 = [] # ????????????2(??????????°´????????????????????¨??¢???)
    A = 0 # ?????¢???

    inp = input()
    #inp = "\\\\///\\_/\\/\\\\\\\\/_/\\\\///__\\\\\\_\\\\/_\\/_/\\"
    for i in range(len(inp)):
        if inp[i] == chr(0x5c): # \ 
            S1.append(i)
            S2.append([i,0])
        elif inp[i] == chr(0x2f): # /
            if len(S1):
                j = S1.pop()
                d = i - j
                A += d
                k = d
                while len(S2):
                    p = S2.pop()
                    if p[1] > 0:
                        k += p[1]
                    else:
                        S2.append([p[0],k])
                        break
        #print("[{}] {} A={} S1:{} S2:{}".format(i,inp[i],A,S1,S2))
    L = []
    for p in S2:
        if p[1] > 0:
            L.append(p[1])
    print(A)
    if A > 0:
        print("{} {}".format(len(L)," ".join(map(str,L))))
    else:
        print("0")


if __name__ == '__main__':
    main()