from collections import deque

T = input()
A = deque()
d = 0
s = 0
for i, token in enumerate(T):
    if token == "\\":
        s += d + 0.5
        if not d:
            l = i
        d += 1
    elif token == "/":
        if not d:
            continue
        d -= 1
        s += d + 0.5
        if not d:
            A.append((l, s))
            s = 0
    else:
        s += d
B = deque()
d = 0
s = 0
for i in range(len(T) - 1, -1, -1):
    token = T[i]
    if token == "/":
        s += d + 0.5
        d += 1
    elif token == "\\":
        if not d:
            continue
        d -= 1
        s += d + 0.5
        if not d:
            B.appendleft((i, s))
            s = 0
    else:
        s += d
S = set(A) | set(B)
S = list(S)
S.sort()
S = [round(s[1]) for s in S]
print(sum(S))
print(len(S), *S)
 from collections import deque T = input() T input() input A = deque() A deque() deque d = 0 d 0 s = 0 s 0 for i, token in enumerate(T):
    if token == "\\":
        s += d + 0.5
        if not d:
            l = i
        d += 1
    elif token == "/":
        if not d:
            continue
        d -= 1
        s += d + 0.5
        if not d:
            A.append((l, s))
            s = 0
    else:
        s += d i token enumerate(T) enumerate T if token == "\\":
        s += d + 0.5
        if not d:
            l = i
        d += 1
    elif token == "/":
        if not d:
            continue
        d -= 1
        s += d + 0.5
        if not d:
            A.append((l, s))
            s = 0
    else:
        s += d token == "\\" token "\\" s += d + 0.5 s d + 0.5 d 0.5 if not d:
            l = i
         not d d l = i l i d += 1 d 1 elif token == "/":
        if not d:
            continue
        d -= 1
        s += d + 0.5
        if not d:
            A.append((l, s))
            s = 0
     token == "/" token "/" if not d:
            continue
         not d d continue d -= 1 d 1 s += d + 0.5 s d + 0.5 d 0.5 if not d:
            A.append((l, s))
            s = 0
     not d d A.append((l, s)) A.append A append (l, s) l s s = 0 s 0 s += d s d B = deque() B deque() deque d = 0 d 0 s = 0 s 0 for i in range(len(T) - 1, -1, -1):
    token = T[i]
    if token == "/":
        s += d + 0.5
        d += 1
    elif token == "\\":
        if not d:
            continue
        d -= 1
        s += d + 0.5
        if not d:
            B.appendleft((i, s))
            s = 0
    else:
        s += d i range(len(T) - 1, -1, -1) range len(T) - 1 len(T) len T 1 -1 -1 token = T[i] token T[i] T i if token == "/":
        s += d + 0.5
        d += 1
    elif token == "\\":
        if not d:
            continue
        d -= 1
        s += d + 0.5
        if not d:
            B.appendleft((i, s))
            s = 0
    else:
        s += d token == "/" token "/" s += d + 0.5 s d + 0.5 d 0.5 d += 1 d 1 elif token == "\\":
        if not d:
            continue
        d -= 1
        s += d + 0.5
        if not d:
            B.appendleft((i, s))
            s = 0
     token == "\\" token "\\" if not d:
            continue
         not d d continue d -= 1 d 1 s += d + 0.5 s d + 0.5 d 0.5 if not d:
            B.appendleft((i, s))
            s = 0
     not d d B.appendleft((i, s)) B.appendleft B appendleft (i, s) i s s = 0 s 0 s += d s d S = set(A) | set(B) S set(A) | set(B) set(A) set A set(B) set B S = list(S) S list(S) list S S.sort() S.sort S sort round(s[1]) for s in S for s in S s S for s in S round(s[1]) round s[1] s 1 S = [round(s[1]) for s in S] S [round(s[1]) for s in S] print(sum(S)) print sum(S) sum S print(len(S), *S) print len(S) len S *S S A = deque() deque() A d += 1 1 d d = 0 0 d s += d + 0.5 d + 0.5 s T = input() input() T d = 0 0 d s += d + 0.5 d + 0.5 s s += d + 0.5 d + 0.5 s s += d d s S = set(A) | set(B) set(A) | set(B) S s = 0 0 s B = deque() deque() B s = 0 0 s s += d + 0.5 d + 0.5 s token = T[i] T[i] token l = i i l S = list(S) list(S) S s = 0 0 s s += d d s d -= 1 1 d d += 1 1 d s = 0 0 s d -= 1 1 d S = [round(s[1]) for s in S] [round(s[1]) for s in S] S
from collections import deque

T = input()
A = deque()
d = 0
s = 0
for i, token in enumerate(T):
    if token == "\\":
        s += d + 0.5
        if not d:
            l = i
        d += 1
    elif token == "/":
        if not d:
            continue
        d -= 1
        s += d + 0.5
        if not d:
            A.append((l, s))
            s = 0
    else:
        s += d
B = deque()
d = 0
s = 0
for i in range(len(T) - 1, -1, -1):
    token = T[i]
    if token == "/":
        s += d + 0.5
        d += 1
    elif token == "\\":
        if not d:
            continue
        d -= 1
        s += d + 0.5
        if not d:
            B.appendleft((i, s))
            s = 0
    else:
        s += d
S = set(A) | set(B)
S = list(S)
S.sort()
S = [round(s[1]) for s in S]
print(sum(S))
print(len(S), *S)

