S = input()
A = []
down = [] # index
Asum = 0

for i, line in enumerate(S):
    if line == "\\":  # "\"
        down.append(i)
    elif line == "/" and down:
        j = down.pop()
        temp = i - j
        Asum += temp
        while A and A[-1][0] > j:
            temp += A.pop()[1]
        A.append([j, temp])

print(Asum)
print(len(A), *[S for i, S in A]) S = input() S input() input A = [] A [] down = [] down [] Asum = 0 Asum 0 for i, line in enumerate(S):
    if line == "\\":  # "\"
        down.append(i)
    elif line == "/" and down:
        j = down.pop()
        temp = i - j
        Asum += temp
        while A and A[-1][0] > j:
            temp += A.pop()[1]
        A.append([j, temp]) i line enumerate(S) enumerate S if line == "\\":  # "\"
        down.append(i)
    elif line == "/" and down:
        j = down.pop()
        temp = i - j
        Asum += temp
        while A and A[-1][0] > j:
            temp += A.pop()[1]
        A.append([j, temp]) line == "\\" line "\\" down.append(i) down.append down append i elif line == "/" and down:
        j = down.pop()
        temp = i - j
        Asum += temp
        while A and A[-1][0] > j:
            temp += A.pop()[1]
        A.append([j, temp]) line == "/" and down line == "/" line "/" down j = down.pop() j down.pop() down.pop down pop temp = i - j temp i - j i j Asum += temp Asum temp while A and A[-1][0] > j:
            temp += A.pop()[1]
         A and A[-1][0] > j A A[-1][0] > j A[-1][0] [-1] A -1 0 j temp += A.pop()[1] temp A.pop()[1] A.pop() A.pop A pop 1 A.append([j, temp]) A.append A append [j, temp] j temp print(Asum) print Asum S for i, S in A for i, S in A i S A for i, S in A S print(len(A), *[S for i, S in A]) print len(A) len A *[S for i, S in A] [S for i, S in A] Asum = 0 0 Asum A = [] [] A S = input() input() S temp = i - j i - j temp temp += A.pop()[1] A.pop()[1] temp j = down.pop() down.pop() j down = [] [] down Asum += temp temp Asum
S = input()
A = []
down = [] # index
Asum = 0

for i, line in enumerate(S):
    if line == "\\":  # "\"
        down.append(i)
    elif line == "/" and down:
        j = down.pop()
        temp = i - j
        Asum += temp
        while A and A[-1][0] > j:
            temp += A.pop()[1]
        A.append([j, temp])

print(Asum)
print(len(A), *[S for i, S in A])
