data = input()
stack = []
lakes = []
for i, X in enumerate(data):
    if X == "\\":
        stack.append(i)
    elif X == "/":
        try:
            j = stack.pop()
        except IndexError:
            continue
        s = 0
        while True:
            if (not lakes) or lakes[-1][1][0] < j:
                break
            s += lakes[-1][0]
            lakes.pop()
        lakes.append([i - j + s, (j, i)])

text = [len(lakes)] + [L[0] for L in lakes]
print(sum(text[1:]))
print(" ".join(list(map(str, text)))) data = input() data input() input stack = [] stack [] lakes = [] lakes [] for i, X in enumerate(data):
    if X == "\\":
        stack.append(i)
    elif X == "/":
        try:
            j = stack.pop()
        except IndexError:
            continue
        s = 0
        while True:
            if (not lakes) or lakes[-1][1][0] < j:
                break
            s += lakes[-1][0]
            lakes.pop()
        lakes.append([i - j + s, (j, i)]) i X enumerate(data) enumerate data if X == "\\":
        stack.append(i)
    elif X == "/":
        try:
            j = stack.pop()
        except IndexError:
            continue
        s = 0
        while True:
            if (not lakes) or lakes[-1][1][0] < j:
                break
            s += lakes[-1][0]
            lakes.pop()
        lakes.append([i - j + s, (j, i)]) X == "\\" X "\\" stack.append(i) stack.append stack append i elif X == "/":
        try:
            j = stack.pop()
        except IndexError:
            continue
        s = 0
        while True:
            if (not lakes) or lakes[-1][1][0] < j:
                break
            s += lakes[-1][0]
            lakes.pop()
        lakes.append([i - j + s, (j, i)]) X == "/" X "/" try:
            j = stack.pop()
        except IndexError:
            continue
         except IndexError:
            continue
         continue j = stack.pop() j stack.pop() stack.pop stack pop s = 0 s 0 while True:
            if (not lakes) or lakes[-1][1][0] < j:
                break
            s += lakes[-1][0]
            lakes.pop()
         True if (not lakes) or lakes[-1][1][0] < j:
                break
             (not lakes) or lakes[-1][1][0] < j not lakes lakes lakes[-1][1][0] < j lakes[-1][1][0] [1] [-1] lakes -1 1 0 j break s += lakes[-1][0] s lakes[-1][0] [-1] lakes -1 0 lakes.pop() lakes.pop lakes pop lakes.append([i - j + s, (j, i)]) lakes.append lakes append [i - j + s, (j, i)] i - j + s i - j i j s (j, i) j i L[0] for L in lakes for L in lakes L lakes for L in lakes L[0] L 0 text = [len(lakes)] + [L[0] for L in lakes] text [len(lakes)] + [L[0] for L in lakes] [len(lakes)] len(lakes) len lakes [L[0] for L in lakes] print(sum(text[1:])) print sum(text[1:]) sum text[1:] text 1: 1 print(" ".join(list(map(str, text)))) print " ".join(list(map(str, text))) " ".join " " join list(map(str, text)) list map(str, text) map str text data = input() input() data j = stack.pop() stack.pop() j s += lakes[-1][0] lakes[-1][0] s s = 0 0 s text = [len(lakes)] + [L[0] for L in lakes] [len(lakes)] + [L[0] for L in lakes] text lakes = [] [] lakes stack = [] [] stack
data = input()
stack = []
lakes = []
for i, X in enumerate(data):
    if X == "\\":
        stack.append(i)
    elif X == "/":
        try:
            j = stack.pop()
        except IndexError:
            continue
        s = 0
        while True:
            if (not lakes) or lakes[-1][1][0] < j:
                break
            s += lakes[-1][0]
            lakes.pop()
        lakes.append([i - j + s, (j, i)])

text = [len(lakes)] + [L[0] for L in lakes]
print(sum(text[1:]))
print(" ".join(list(map(str, text))))