if __name__ == "__main__":
    inp = input()
    a = []
    ans = []
    total = 0
    for i in range(len(inp)):
        if inp[i] == "\\":
            a.append(i)
        elif inp[i] == "/":
            if len(a) != 0:
                x = a.pop()
                d = i - x
                total += d
                while len(ans) != 0 and ans[-1][0] > x:
                    d += ans[-1][1]
                    ans.pop()
                ans.append([x, d])
    print(total)
    if total == 0:
        print(0)
    else:
        print(str(len(ans))+" "+(" ".join(map(str, [x[1] for x in ans])))) if __name__ == "__main__":
    inp = input()
    a = []
    ans = []
    total = 0
    for i in range(len(inp)):
        if inp[i] == "\\":
            a.append(i)
        elif inp[i] == "/":
            if len(a) != 0:
                x = a.pop()
                d = i - x
                total += d
                while len(ans) != 0 and ans[-1][0] > x:
                    d += ans[-1][1]
                    ans.pop()
                ans.append([x, d])
    print(total)
    if total == 0:
        print(0)
    else:
        print(str(len(ans))+" "+(" ".join(map(str, [x[1] for x in ans])))) __name__ == "__main__" __name__ "__main__" inp = input() inp input() input a = [] a [] ans = [] ans [] total = 0 total 0 for i in range(len(inp)):
        if inp[i] == "\\":
            a.append(i)
        elif inp[i] == "/":
            if len(a) != 0:
                x = a.pop()
                d = i - x
                total += d
                while len(ans) != 0 and ans[-1][0] > x:
                    d += ans[-1][1]
                    ans.pop()
                ans.append([x, d])
     i range(len(inp)) range len(inp) len inp if inp[i] == "\\":
            a.append(i)
        elif inp[i] == "/":
            if len(a) != 0:
                x = a.pop()
                d = i - x
                total += d
                while len(ans) != 0 and ans[-1][0] > x:
                    d += ans[-1][1]
                    ans.pop()
                ans.append([x, d])
     inp[i] == "\\" inp[i] inp i "\\" a.append(i) a.append a append i elif inp[i] == "/":
            if len(a) != 0:
                x = a.pop()
                d = i - x
                total += d
                while len(ans) != 0 and ans[-1][0] > x:
                    d += ans[-1][1]
                    ans.pop()
                ans.append([x, d])
     inp[i] == "/" inp[i] inp i "/" if len(a) != 0:
                x = a.pop()
                d = i - x
                total += d
                while len(ans) != 0 and ans[-1][0] > x:
                    d += ans[-1][1]
                    ans.pop()
                ans.append([x, d])
     len(a) != 0 len(a) len a 0 x = a.pop() x a.pop() a.pop a pop d = i - x d i - x i x total += d total d while len(ans) != 0 and ans[-1][0] > x:
                    d += ans[-1][1]
                    ans.pop()
                 len(ans) != 0 and ans[-1][0] > x len(ans) != 0 len(ans) len ans 0 ans[-1][0] > x ans[-1][0] [-1] ans -1 0 x d += ans[-1][1] d ans[-1][1] [-1] ans -1 1 ans.pop() ans.pop ans pop ans.append([x, d]) ans.append ans append [x, d] x d print(total) print total if total == 0:
        print(0)
    else:
        print(str(len(ans))+" "+(" ".join(map(str, [x[1] for x in ans])))) total == 0 total 0 print(0) print 0 x[1] for x in ans for x in ans x ans for x in ans x[1] x 1 print(str(len(ans))+" "+(" ".join(map(str, [x[1] for x in ans])))) print str(len(ans))+" "+(" ".join(map(str, [x[1] for x in ans]))) str(len(ans))+" " str(len(ans)) str len(ans) len ans " " " ".join(map(str, [x[1] for x in ans])) " ".join " " join map(str, [x[1] for x in ans]) map str [x[1] for x in ans] ans = [] [] ans total += d d total a = [] [] a total = 0 0 total d = i - x i - x d inp = input() input() inp x = a.pop() a.pop() x d += ans[-1][1] ans[-1][1] d
if __name__ == "__main__":
    inp = input()
    a = []
    ans = []
    total = 0
    for i in range(len(inp)):
        if inp[i] == "\\":
            a.append(i)
        elif inp[i] == "/":
            if len(a) != 0:
                x = a.pop()
                d = i - x
                total += d
                while len(ans) != 0 and ans[-1][0] > x:
                    d += ans[-1][1]
                    ans.pop()
                ans.append([x, d])
    print(total)
    if total == 0:
        print(0)
    else:
        print(str(len(ans))+" "+(" ".join(map(str, [x[1] for x in ans]))))