import collections
import sys

S1 = collections.deque()
S2 = collections.deque()

for i, j in enumerate(sys.stdin.readline()):
    if j == '\\':
        S1.append(i)
    elif j == '/':
        if S1:
            left_edge = S1.pop()
            new_puddle = i - left_edge
            while S2 and (S2[-1][0] > left_edge):
                new_puddle += S2[-1][1]
                S2.pop()
            S2.append((left_edge, new_puddle))
        else:
            pass


print(sum(j for i, j in S2))

print(len(S2), *(j for i, j in S2)) import collections collections import sys sys S1 = collections.deque() S1 collections.deque() collections.deque collections deque S2 = collections.deque() S2 collections.deque() collections.deque collections deque for i, j in enumerate(sys.stdin.readline()):
    if j == '\\':
        S1.append(i)
    elif j == '/':
        if S1:
            left_edge = S1.pop()
            new_puddle = i - left_edge
            while S2 and (S2[-1][0] > left_edge):
                new_puddle += S2[-1][1]
                S2.pop()
            S2.append((left_edge, new_puddle))
        else:
            pass i j enumerate(sys.stdin.readline()) enumerate sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline if j == '\\':
        S1.append(i)
    elif j == '/':
        if S1:
            left_edge = S1.pop()
            new_puddle = i - left_edge
            while S2 and (S2[-1][0] > left_edge):
                new_puddle += S2[-1][1]
                S2.pop()
            S2.append((left_edge, new_puddle))
        else:
            pass j == '\\' j '\\' S1.append(i) S1.append S1 append i elif j == '/':
        if S1:
            left_edge = S1.pop()
            new_puddle = i - left_edge
            while S2 and (S2[-1][0] > left_edge):
                new_puddle += S2[-1][1]
                S2.pop()
            S2.append((left_edge, new_puddle))
        else:
            pass j == '/' j '/' if S1:
            left_edge = S1.pop()
            new_puddle = i - left_edge
            while S2 and (S2[-1][0] > left_edge):
                new_puddle += S2[-1][1]
                S2.pop()
            S2.append((left_edge, new_puddle))
        else:
            pass S1 left_edge = S1.pop() left_edge S1.pop() S1.pop S1 pop new_puddle = i - left_edge new_puddle i - left_edge i left_edge while S2 and (S2[-1][0] > left_edge):
                new_puddle += S2[-1][1]
                S2.pop()
             S2 and (S2[-1][0] > left_edge) S2 S2[-1][0] > left_edge S2[-1][0] [-1] S2 -1 0 left_edge new_puddle += S2[-1][1] new_puddle S2[-1][1] [-1] S2 -1 1 S2.pop() S2.pop S2 pop S2.append((left_edge, new_puddle)) S2.append S2 append (left_edge, new_puddle) left_edge new_puddle print(sum(j for i, j in S2)) print sum(j for i, j in S2) sum j j for i, j in S2 for i, j in S2 i j S2 for i, j in S2 j print(len(S2), *(j for i, j in S2)) print len(S2) len S2 *(j for i, j in S2) (j for i, j in S2) S1 = collections.deque() collections.deque() S1 new_puddle = i - left_edge i - left_edge new_puddle new_puddle += S2[-1][1] S2[-1][1] new_puddle left_edge = S1.pop() S1.pop() left_edge S2 = collections.deque() collections.deque() S2
import collections
import sys

S1 = collections.deque()
S2 = collections.deque()

for i, j in enumerate(sys.stdin.readline()):
    if j == '\\':
        S1.append(i)
    elif j == '/':
        if S1:
            left_edge = S1.pop()
            new_puddle = i - left_edge
            while S2 and (S2[-1][0] > left_edge):
                new_puddle += S2[-1][1]
                S2.pop()
            S2.append((left_edge, new_puddle))
        else:
            pass


print(sum(j for i, j in S2))

print(len(S2), *(j for i, j in S2))