s = input()
left_index = []
puddles = []

for i in range(len(s)):
    if s[i] == "\\":
        left_index.append(i)

    elif s[i] == "/" and len(left_index) > 0:
        left = left_index.pop()
        puddle = i - left

        while len(puddles) > 0 and puddles[-1][0] > left:
            puddle += puddles.pop()[1]

        puddles.append([left, puddle])

ans = [p[1] for p in puddles]
print(sum(ans))
if len(ans): print(len(ans), " ".join(map(str, ans)))
else : print(len(ans))
 s = input() s input() input left_index = [] left_index [] puddles = [] puddles [] for i in range(len(s)):
    if s[i] == "\\":
        left_index.append(i)

    elif s[i] == "/" and len(left_index) > 0:
        left = left_index.pop()
        puddle = i - left

        while len(puddles) > 0 and puddles[-1][0] > left:
            puddle += puddles.pop()[1]

        puddles.append([left, puddle]) i range(len(s)) range len(s) len s if s[i] == "\\":
        left_index.append(i)

    elif s[i] == "/" and len(left_index) > 0:
        left = left_index.pop()
        puddle = i - left

        while len(puddles) > 0 and puddles[-1][0] > left:
            puddle += puddles.pop()[1]

        puddles.append([left, puddle]) s[i] == "\\" s[i] s i "\\" left_index.append(i) left_index.append left_index append i elif s[i] == "/" and len(left_index) > 0:
        left = left_index.pop()
        puddle = i - left

        while len(puddles) > 0 and puddles[-1][0] > left:
            puddle += puddles.pop()[1]

        puddles.append([left, puddle]) s[i] == "/" and len(left_index) > 0 s[i] == "/" s[i] s i "/" len(left_index) > 0 len(left_index) len left_index 0 left = left_index.pop() left left_index.pop() left_index.pop left_index pop puddle = i - left puddle i - left i left while len(puddles) > 0 and puddles[-1][0] > left:
            puddle += puddles.pop()[1]

         len(puddles) > 0 and puddles[-1][0] > left len(puddles) > 0 len(puddles) len puddles 0 puddles[-1][0] > left puddles[-1][0] [-1] puddles -1 0 left puddle += puddles.pop()[1] puddle puddles.pop()[1] puddles.pop() puddles.pop puddles pop 1 puddles.append([left, puddle]) puddles.append puddles append [left, puddle] left puddle p[1] for p in puddles for p in puddles p puddles for p in puddles p[1] p 1 ans = [p[1] for p in puddles] ans [p[1] for p in puddles] print(sum(ans)) print sum(ans) sum ans if len(ans): print(len(ans), " ".join(map(str, ans)))
else : print(len(ans)) len(ans) len ans left_index = [] [] left_index puddle = i - left i - left puddle left = left_index.pop() left_index.pop() left puddle += puddles.pop()[1] puddles.pop()[1] puddle ans = [p[1] for p in puddles] [p[1] for p in puddles] ans s = input() input() s puddles = [] [] puddles
s = input()
left_index = []
puddles = []

for i in range(len(s)):
    if s[i] == "\\":
        left_index.append(i)

    elif s[i] == "/" and len(left_index) > 0:
        left = left_index.pop()
        puddle = i - left

        while len(puddles) > 0 and puddles[-1][0] > left:
            puddle += puddles.pop()[1]

        puddles.append([left, puddle])

ans = [p[1] for p in puddles]
print(sum(ans))
if len(ans): print(len(ans), " ".join(map(str, ans)))
else : print(len(ans))

