import collections

S1 = collections.deque()
s_a = 0

S2 = collections.deque()

for i, j in enumerate(input()):
    if j == '\\':
        S1.append(i)
    elif j == '/':
        if S1:
            left_edge = S1.pop()
            diff = i - left_edge
            s_a += diff
            new_puddle_a = diff
            while True:
                if S2:
                    if S2[-1][0] > left_edge:
                        new_puddle_a += S2[-1][1]
                        S2.pop()
                    else:
                        break
                else:
                    break
            new_puddle = (left_edge, new_puddle_a)
            S2.append(new_puddle)
        else:
            pass


print(s_a)

num_of_puddles = len(S2)
puddles = str(num_of_puddles)

for i in range(num_of_puddles):
    puddle = S2.popleft()
    puddles += ' {0}'.format(str(puddle[1]))
else:
    print(puddles) import collections collections S1 = collections.deque() S1 collections.deque() collections.deque collections deque s_a = 0 s_a 0 S2 = collections.deque() S2 collections.deque() collections.deque collections deque for i, j in enumerate(input()):
    if j == '\\':
        S1.append(i)
    elif j == '/':
        if S1:
            left_edge = S1.pop()
            diff = i - left_edge
            s_a += diff
            new_puddle_a = diff
            while True:
                if S2:
                    if S2[-1][0] > left_edge:
                        new_puddle_a += S2[-1][1]
                        S2.pop()
                    else:
                        break
                else:
                    break
            new_puddle = (left_edge, new_puddle_a)
            S2.append(new_puddle)
        else:
            pass i j enumerate(input()) enumerate input() input if j == '\\':
        S1.append(i)
    elif j == '/':
        if S1:
            left_edge = S1.pop()
            diff = i - left_edge
            s_a += diff
            new_puddle_a = diff
            while True:
                if S2:
                    if S2[-1][0] > left_edge:
                        new_puddle_a += S2[-1][1]
                        S2.pop()
                    else:
                        break
                else:
                    break
            new_puddle = (left_edge, new_puddle_a)
            S2.append(new_puddle)
        else:
            pass j == '\\' j '\\' S1.append(i) S1.append S1 append i elif j == '/':
        if S1:
            left_edge = S1.pop()
            diff = i - left_edge
            s_a += diff
            new_puddle_a = diff
            while True:
                if S2:
                    if S2[-1][0] > left_edge:
                        new_puddle_a += S2[-1][1]
                        S2.pop()
                    else:
                        break
                else:
                    break
            new_puddle = (left_edge, new_puddle_a)
            S2.append(new_puddle)
        else:
            pass j == '/' j '/' if S1:
            left_edge = S1.pop()
            diff = i - left_edge
            s_a += diff
            new_puddle_a = diff
            while True:
                if S2:
                    if S2[-1][0] > left_edge:
                        new_puddle_a += S2[-1][1]
                        S2.pop()
                    else:
                        break
                else:
                    break
            new_puddle = (left_edge, new_puddle_a)
            S2.append(new_puddle)
        else:
            pass S1 left_edge = S1.pop() left_edge S1.pop() S1.pop S1 pop diff = i - left_edge diff i - left_edge i left_edge s_a += diff s_a diff new_puddle_a = diff new_puddle_a diff while True:
                if S2:
                    if S2[-1][0] > left_edge:
                        new_puddle_a += S2[-1][1]
                        S2.pop()
                    else:
                        break
                else:
                    break
             True if S2:
                    if S2[-1][0] > left_edge:
                        new_puddle_a += S2[-1][1]
                        S2.pop()
                    else:
                        break
                else:
                    break
             S2 if S2[-1][0] > left_edge:
                        new_puddle_a += S2[-1][1]
                        S2.pop()
                    else:
                        break
                 S2[-1][0] > left_edge S2[-1][0] [-1] S2 -1 0 left_edge new_puddle_a += S2[-1][1] new_puddle_a S2[-1][1] [-1] S2 -1 1 S2.pop() S2.pop S2 pop break break new_puddle = (left_edge, new_puddle_a) new_puddle (left_edge, new_puddle_a) left_edge new_puddle_a S2.append(new_puddle) S2.append S2 append new_puddle print(s_a) print s_a num_of_puddles = len(S2) num_of_puddles len(S2) len S2 puddles = str(num_of_puddles) puddles str(num_of_puddles) str num_of_puddles for i in range(num_of_puddles):
    puddle = S2.popleft()
    puddles += ' {0}'.format(str(puddle[1]))
else:
    print(puddles) i range(num_of_puddles) range num_of_puddles puddle = S2.popleft() puddle S2.popleft() S2.popleft S2 popleft puddles += ' {0}'.format(str(puddle[1])) puddles ' {0}'.format(str(puddle[1])) ' {0}'.format ' {0}' format str(puddle[1]) str puddle[1] puddle 1 print(puddles) print puddles puddles += ' {0}'.format(str(puddle[1])) ' {0}'.format(str(puddle[1])) puddles s_a = 0 0 s_a puddles = str(num_of_puddles) str(num_of_puddles) puddles S2 = collections.deque() collections.deque() S2 new_puddle_a += S2[-1][1] S2[-1][1] new_puddle_a new_puddle = (left_edge, new_puddle_a) (left_edge, new_puddle_a) new_puddle diff = i - left_edge i - left_edge diff S1 = collections.deque() collections.deque() S1 new_puddle_a = diff diff new_puddle_a num_of_puddles = len(S2) len(S2) num_of_puddles left_edge = S1.pop() S1.pop() left_edge puddle = S2.popleft() S2.popleft() puddle s_a += diff diff s_a
import collections

S1 = collections.deque()
s_a = 0

S2 = collections.deque()

for i, j in enumerate(input()):
    if j == '\\':
        S1.append(i)
    elif j == '/':
        if S1:
            left_edge = S1.pop()
            diff = i - left_edge
            s_a += diff
            new_puddle_a = diff
            while True:
                if S2:
                    if S2[-1][0] > left_edge:
                        new_puddle_a += S2[-1][1]
                        S2.pop()
                    else:
                        break
                else:
                    break
            new_puddle = (left_edge, new_puddle_a)
            S2.append(new_puddle)
        else:
            pass


print(s_a)

num_of_puddles = len(S2)
puddles = str(num_of_puddles)

for i in range(num_of_puddles):
    puddle = S2.popleft()
    puddles += ' {0}'.format(str(puddle[1]))
else:
    print(puddles)