s = input()

length = len(s)

a = [0] * (length + 1)
b = [0] * length
y = 0
for i in range(length):
    if s[i] == '/':
        y += 1
    elif s[i] == '\\':
        y -= 1
    a[i + 1] = y

m = -30000
for i in range(length, 0, -1):
    m = max(m, a[i])
    b[i - 1] = m

i = 0
memory = []
while i < length:
    if a[i] > b[i]:
        i += 1
        continue

    start = a[i]
    i += 1
    base = 1
    d_from = s[i - 1]
    ws_part = 0
    while i < length + 1 and a[i] < start:
        d_to = s[i]
        ws_part += base
        if d_from == '\\' and d_to == '\\':
            base += 2
        if d_from == '\\' and d_to == '_':
            base += 1
        if d_from == '/' and d_to == '/':
            base -= 2
        if d_from == '/' and d_to == '_':
            base -= 1
        if d_from == '_' and d_to == '\\':
            base += 1
        if d_from == '_' and d_to == '/':
            base -= 1
        d_from = d_to
        i += 1

    if ws_part > 0:
        ws_part += 1
        memory.append(ws_part // 2)

print(sum(memory))
if memory:
    print(len(memory), ' '.join(map(str, memory)))
else:
    print(len(memory))
 s = input() s input() input length = len(s) length len(s) len s a = [0] * (length + 1) a [0] * (length + 1) [0] 0 length + 1 length 1 b = [0] * length b [0] * length [0] 0 length y = 0 y 0 for i in range(length):
    if s[i] == '/':
        y += 1
    elif s[i] == '\\':
        y -= 1
    a[i + 1] = y i range(length) range length if s[i] == '/':
        y += 1
    elif s[i] == '\\':
        y -= 1
     s[i] == '/' s[i] s i '/' y += 1 y 1 elif s[i] == '\\':
        y -= 1
     s[i] == '\\' s[i] s i '\\' y -= 1 y 1 a[i + 1] = y a[i + 1] a i + 1 i 1 y m = -30000 m -30000 for i in range(length, 0, -1):
    m = max(m, a[i])
    b[i - 1] = m i range(length, 0, -1) range length 0 -1 m = max(m, a[i]) m max(m, a[i]) max m a[i] a i b[i - 1] = m b[i - 1] b i - 1 i 1 m i = 0 i 0 memory = [] memory [] while i < length:
    if a[i] > b[i]:
        i += 1
        continue

    start = a[i]
    i += 1
    base = 1
    d_from = s[i - 1]
    ws_part = 0
    while i < length + 1 and a[i] < start:
        d_to = s[i]
        ws_part += base
        if d_from == '\\' and d_to == '\\':
            base += 2
        if d_from == '\\' and d_to == '_':
            base += 1
        if d_from == '/' and d_to == '/':
            base -= 2
        if d_from == '/' and d_to == '_':
            base -= 1
        if d_from == '_' and d_to == '\\':
            base += 1
        if d_from == '_' and d_to == '/':
            base -= 1
        d_from = d_to
        i += 1

    if ws_part > 0:
        ws_part += 1
        memory.append(ws_part // 2) i < length i length if a[i] > b[i]:
        i += 1
        continue

     a[i] > b[i] a[i] a i b[i] b i i += 1 i 1 continue start = a[i] start a[i] a i i += 1 i 1 base = 1 base 1 d_from = s[i - 1] d_from s[i - 1] s i - 1 i 1 ws_part = 0 ws_part 0 while i < length + 1 and a[i] < start:
        d_to = s[i]
        ws_part += base
        if d_from == '\\' and d_to == '\\':
            base += 2
        if d_from == '\\' and d_to == '_':
            base += 1
        if d_from == '/' and d_to == '/':
            base -= 2
        if d_from == '/' and d_to == '_':
            base -= 1
        if d_from == '_' and d_to == '\\':
            base += 1
        if d_from == '_' and d_to == '/':
            base -= 1
        d_from = d_to
        i += 1

     i < length + 1 and a[i] < start i < length + 1 i length + 1 length 1 a[i] < start a[i] a i start d_to = s[i] d_to s[i] s i ws_part += base ws_part base if d_from == '\\' and d_to == '\\':
            base += 2
         d_from == '\\' and d_to == '\\' d_from == '\\' d_from '\\' d_to == '\\' d_to '\\' base += 2 base 2 if d_from == '\\' and d_to == '_':
            base += 1
         d_from == '\\' and d_to == '_' d_from == '\\' d_from '\\' d_to == '_' d_to '_' base += 1 base 1 if d_from == '/' and d_to == '/':
            base -= 2
         d_from == '/' and d_to == '/' d_from == '/' d_from '/' d_to == '/' d_to '/' base -= 2 base 2 if d_from == '/' and d_to == '_':
            base -= 1
         d_from == '/' and d_to == '_' d_from == '/' d_from '/' d_to == '_' d_to '_' base -= 1 base 1 if d_from == '_' and d_to == '\\':
            base += 1
         d_from == '_' and d_to == '\\' d_from == '_' d_from '_' d_to == '\\' d_to '\\' base += 1 base 1 if d_from == '_' and d_to == '/':
            base -= 1
         d_from == '_' and d_to == '/' d_from == '_' d_from '_' d_to == '/' d_to '/' base -= 1 base 1 d_from = d_to d_from d_to i += 1 i 1 if ws_part > 0:
        ws_part += 1
        memory.append(ws_part // 2) ws_part > 0 ws_part 0 ws_part += 1 ws_part 1 memory.append(ws_part // 2) memory.append memory append ws_part // 2 ws_part 2 print(sum(memory)) print sum(memory) sum memory if memory:
    print(len(memory), ' '.join(map(str, memory)))
else:
    print(len(memory)) memory print(len(memory), ' '.join(map(str, memory))) print len(memory) len memory ' '.join(map(str, memory)) ' '.join ' ' join map(str, memory) map str memory print(len(memory)) print len(memory) len memory base = 1 1 base y -= 1 1 y i += 1 1 i m = -30000 -30000 m memory = [] [] memory base -= 1 1 base y += 1 1 y y = 0 0 y ws_part += base base ws_part base -= 1 1 base length = len(s) len(s) length start = a[i] a[i] start base += 1 1 base ws_part = 0 0 ws_part ws_part += 1 1 ws_part base -= 2 2 base i += 1 1 i base += 2 2 base i += 1 1 i m = max(m, a[i]) max(m, a[i]) m d_from = s[i - 1] s[i - 1] d_from a = [0] * (length + 1) [0] * (length + 1) a d_from = d_to d_to d_from base += 1 1 base b = [0] * length [0] * length b d_to = s[i] s[i] d_to i = 0 0 i s = input() input() s
s = input()

length = len(s)

a = [0] * (length + 1)
b = [0] * length
y = 0
for i in range(length):
    if s[i] == '/':
        y += 1
    elif s[i] == '\\':
        y -= 1
    a[i + 1] = y

m = -30000
for i in range(length, 0, -1):
    m = max(m, a[i])
    b[i - 1] = m

i = 0
memory = []
while i < length:
    if a[i] > b[i]:
        i += 1
        continue

    start = a[i]
    i += 1
    base = 1
    d_from = s[i - 1]
    ws_part = 0
    while i < length + 1 and a[i] < start:
        d_to = s[i]
        ws_part += base
        if d_from == '\\' and d_to == '\\':
            base += 2
        if d_from == '\\' and d_to == '_':
            base += 1
        if d_from == '/' and d_to == '/':
            base -= 2
        if d_from == '/' and d_to == '_':
            base -= 1
        if d_from == '_' and d_to == '\\':
            base += 1
        if d_from == '_' and d_to == '/':
            base -= 1
        d_from = d_to
        i += 1

    if ws_part > 0:
        ws_part += 1
        memory.append(ws_part // 2)

print(sum(memory))
if memory:
    print(len(memory), ' '.join(map(str, memory)))
else:
    print(len(memory))

