from collections import deque
que = deque()
l = input()
S = 0
S2 = []
for j in range(len(l)):
    i = l[j]
    if i == '\\':
        que.append(j)
        continue
    elif i == '/':
        if len(que) == 0:
            continue
        k = que.pop()
        pond_sum = j-k
        S += pond_sum
        while S2 and S2[-1][0] > k:
            pond_sum += S2[-1][1]
            S2.pop()
        S2.append([k,pond_sum])
    elif i == '_':
        continue
data = [i for j,i in S2]
print(S)
print(len(S2),*data) from collections import deque que = deque() que deque() deque l = input() l input() input S = 0 S 0 S2 = [] S2 [] for j in range(len(l)):
    i = l[j]
    if i == '\\':
        que.append(j)
        continue
    elif i == '/':
        if len(que) == 0:
            continue
        k = que.pop()
        pond_sum = j-k
        S += pond_sum
        while S2 and S2[-1][0] > k:
            pond_sum += S2[-1][1]
            S2.pop()
        S2.append([k,pond_sum])
    elif i == '_':
        continue j range(len(l)) range len(l) len l i = l[j] i l[j] l j if i == '\\':
        que.append(j)
        continue
    elif i == '/':
        if len(que) == 0:
            continue
        k = que.pop()
        pond_sum = j-k
        S += pond_sum
        while S2 and S2[-1][0] > k:
            pond_sum += S2[-1][1]
            S2.pop()
        S2.append([k,pond_sum])
    elif i == '_':
        continue i == '\\' i '\\' que.append(j) que.append que append j continue elif i == '/':
        if len(que) == 0:
            continue
        k = que.pop()
        pond_sum = j-k
        S += pond_sum
        while S2 and S2[-1][0] > k:
            pond_sum += S2[-1][1]
            S2.pop()
        S2.append([k,pond_sum])
     i == '/' i '/' if len(que) == 0:
            continue
         len(que) == 0 len(que) len que 0 continue k = que.pop() k que.pop() que.pop que pop pond_sum = j-k pond_sum j-k j k S += pond_sum S pond_sum while S2 and S2[-1][0] > k:
            pond_sum += S2[-1][1]
            S2.pop()
         S2 and S2[-1][0] > k S2 S2[-1][0] > k S2[-1][0] [-1] S2 -1 0 k pond_sum += S2[-1][1] pond_sum S2[-1][1] [-1] S2 -1 1 S2.pop() S2.pop S2 pop S2.append([k,pond_sum]) S2.append S2 append [k,pond_sum] k pond_sum elif i == '_':
        continue i == '_' i '_' continue i for j,i in S2 for j,i in S2 j i S2 for j,i in S2 i data = [i for j,i in S2] data [i for j,i in S2] print(S) print S print(len(S2),*data) print len(S2) len S2 *data data S += pond_sum pond_sum S l = input() input() l pond_sum = j-k j-k pond_sum S = 0 0 S data = [i for j,i in S2] [i for j,i in S2] data pond_sum += S2[-1][1] S2[-1][1] pond_sum S2 = [] [] S2 i = l[j] l[j] i k = que.pop() que.pop() k que = deque() deque() que
from collections import deque
que = deque()
l = input()
S = 0
S2 = []
for j in range(len(l)):
    i = l[j]
    if i == '\\':
        que.append(j)
        continue
    elif i == '/':
        if len(que) == 0:
            continue
        k = que.pop()
        pond_sum = j-k
        S += pond_sum
        while S2 and S2[-1][0] > k:
            pond_sum += S2[-1][1]
            S2.pop()
        S2.append([k,pond_sum])
    elif i == '_':
        continue
data = [i for j,i in S2]
print(S)
print(len(S2),*data)
