string = input()

h = 0
A = [h]
for c in string:
    if c == "/": h += 1
    elif c == "\\": h -= 1
    A.append(h)

flg = False
ans1 = []
ans2 = []

forward = True
while len(A) > 1:
    h = 0
    B = [0]

    for i in range(len(A) - 1):
        if not flg: B = [0]

        d = A[i + 1] - A[i]
        if d < 0: flg = True
        h += d

        if h <= 0:
            B.append(h)

            if h == 0:
                if len(B) > 2:
                    if forward: ans1.append(abs(sum(B)))
                    else: ans2.append(abs(sum(B)))
                B = []
                flg = False
        else:
            h = 0

    A = B.copy()
    A.reverse()
    forward = (forward + 1) % 2

ans2.reverse()
ans = ans1 + ans2

print(sum(ans))
print(len(ans), *ans) string = input() string input() input h = 0 h 0 A = [h] A [h] h for c in string:
    if c == "/": h += 1
    elif c == "\\": h -= 1
    A.append(h) c string if c == "/": h += 1
    elif c == "\\": h -= 1
     c == "/" c "/" elif c == "\\": h -= 1
     c == "\\" c "\\" A.append(h) A.append A append h flg = False flg False ans1 = [] ans1 [] ans2 = [] ans2 [] forward = True forward True while len(A) > 1:
    h = 0
    B = [0]

    for i in range(len(A) - 1):
        if not flg: B = [0]

        d = A[i + 1] - A[i]
        if d < 0: flg = True
        h += d

        if h <= 0:
            B.append(h)

            if h == 0:
                if len(B) > 2:
                    if forward: ans1.append(abs(sum(B)))
                    else: ans2.append(abs(sum(B)))
                B = []
                flg = False
        else:
            h = 0

    A = B.copy()
    A.reverse()
    forward = (forward + 1) % 2 len(A) > 1 len(A) len A 1 h = 0 h 0 B = [0] B [0] 0 for i in range(len(A) - 1):
        if not flg: B = [0]

        d = A[i + 1] - A[i]
        if d < 0: flg = True
        h += d

        if h <= 0:
            B.append(h)

            if h == 0:
                if len(B) > 2:
                    if forward: ans1.append(abs(sum(B)))
                    else: ans2.append(abs(sum(B)))
                B = []
                flg = False
        else:
            h = 0

     i range(len(A) - 1) range len(A) - 1 len(A) len A 1 if not flg: B = [0]

         not flg flg d = A[i + 1] - A[i] d A[i + 1] - A[i] A[i + 1] A i + 1 i 1 A[i] A i if d < 0: flg = True
         d < 0 d 0 h += d h d if h <= 0:
            B.append(h)

            if h == 0:
                if len(B) > 2:
                    if forward: ans1.append(abs(sum(B)))
                    else: ans2.append(abs(sum(B)))
                B = []
                flg = False
        else:
            h = 0

     h <= 0 h 0 B.append(h) B.append B append h if h == 0:
                if len(B) > 2:
                    if forward: ans1.append(abs(sum(B)))
                    else: ans2.append(abs(sum(B)))
                B = []
                flg = False
         h == 0 h 0 if len(B) > 2:
                    if forward: ans1.append(abs(sum(B)))
                    else: ans2.append(abs(sum(B)))
                 len(B) > 2 len(B) len B 2 if forward: ans1.append(abs(sum(B)))
                    else: ans2.append(abs(sum(B)))
                 forward B = [] B [] flg = False flg False h = 0 h 0 A = B.copy() A B.copy() B.copy B copy A.reverse() A.reverse A reverse forward = (forward + 1) % 2 forward (forward + 1) % 2 forward + 1 forward 1 2 ans2.reverse() ans2.reverse ans2 reverse ans = ans1 + ans2 ans ans1 + ans2 ans1 ans2 print(sum(ans)) print sum(ans) sum ans print(len(ans), *ans) print len(ans) len ans *ans ans h = 0 0 h h = 0 0 h forward = (forward + 1) % 2 (forward + 1) % 2 forward B = [0] [0] B ans = ans1 + ans2 ans1 + ans2 ans string = input() input() string A = [h] [h] A ans1 = [] [] ans1 A = B.copy() B.copy() A d = A[i + 1] - A[i] A[i + 1] - A[i] d B = [] [] B h += d d h flg = False False flg flg = False False flg h = 0 0 h ans2 = [] [] ans2 forward = True True forward
string = input()

h = 0
A = [h]
for c in string:
    if c == "/": h += 1
    elif c == "\\": h -= 1
    A.append(h)

flg = False
ans1 = []
ans2 = []

forward = True
while len(A) > 1:
    h = 0
    B = [0]

    for i in range(len(A) - 1):
        if not flg: B = [0]

        d = A[i + 1] - A[i]
        if d < 0: flg = True
        h += d

        if h <= 0:
            B.append(h)

            if h == 0:
                if len(B) > 2:
                    if forward: ans1.append(abs(sum(B)))
                    else: ans2.append(abs(sum(B)))
                B = []
                flg = False
        else:
            h = 0

    A = B.copy()
    A.reverse()
    forward = (forward + 1) % 2

ans2.reverse()
ans = ans1 + ans2

print(sum(ans))
print(len(ans), *ans)
