import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    S = input()
    pair = []
    stack = [('%',-1)]
    for j,s in enumerate(S):
        if s == '/':
            if stack[-1][0] == '\\':
                i = stack[-1][1]
                stack.pop()
                pair.append((i,j))
        elif s == '_':
            continue
        else:
            stack.append((s,j))
    
    pond = []
    tot = 0
    k = len(pair) - 1
    while  k >= 0:
        fin = pair[k][0] - 1
        area = 0
        while k >= 0 and fin < pair[k][0]:
            area += pair[k][1] - pair[k][0]
            k -= 1
        pond.append(area)
        tot += area
    pond.append(len(pond))

    print(tot)
    print(*pond[::-1])
if __name__ == '__main__':
    main() import sys sys sys.setrecursionlimit(10000000) sys.setrecursionlimit sys setrecursionlimit 10000000 MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 INF = 10 ** 15 INF 10 ** 15 10 15 def main():
    S = input()
    pair = []
    stack = [('%',-1)]
    for j,s in enumerate(S):
        if s == '/':
            if stack[-1][0] == '\\':
                i = stack[-1][1]
                stack.pop()
                pair.append((i,j))
        elif s == '_':
            continue
        else:
            stack.append((s,j))
    
    pond = []
    tot = 0
    k = len(pair) - 1
    while  k >= 0:
        fin = pair[k][0] - 1
        area = 0
        while k >= 0 and fin < pair[k][0]:
            area += pair[k][1] - pair[k][0]
            k -= 1
        pond.append(area)
        tot += area
    pond.append(len(pond))

    print(tot)
    print(*pond[::-1]) main S = input() S input() input pair = [] pair [] stack = [('%',-1)] stack [('%',-1)] ('%',-1) '%' -1 for j,s in enumerate(S):
        if s == '/':
            if stack[-1][0] == '\\':
                i = stack[-1][1]
                stack.pop()
                pair.append((i,j))
        elif s == '_':
            continue
        else:
            stack.append((s,j))
    
     j s enumerate(S) enumerate S if s == '/':
            if stack[-1][0] == '\\':
                i = stack[-1][1]
                stack.pop()
                pair.append((i,j))
        elif s == '_':
            continue
        else:
            stack.append((s,j))
    
     s == '/' s '/' if stack[-1][0] == '\\':
                i = stack[-1][1]
                stack.pop()
                pair.append((i,j))
         stack[-1][0] == '\\' stack[-1][0] [-1] stack -1 0 '\\' i = stack[-1][1] i stack[-1][1] [-1] stack -1 1 stack.pop() stack.pop stack pop pair.append((i,j)) pair.append pair append (i,j) i j elif s == '_':
            continue
         s == '_' s '_' continue stack.append((s,j)) stack.append stack append (s,j) s j pond = [] pond [] tot = 0 tot 0 k = len(pair) - 1 k len(pair) - 1 len(pair) len pair 1 while  k >= 0:
        fin = pair[k][0] - 1
        area = 0
        while k >= 0 and fin < pair[k][0]:
            area += pair[k][1] - pair[k][0]
            k -= 1
        pond.append(area)
        tot += area
     k >= 0 k 0 fin = pair[k][0] - 1 fin pair[k][0] - 1 pair[k][0] [k] pair k 0 1 area = 0 area 0 while k >= 0 and fin < pair[k][0]:
            area += pair[k][1] - pair[k][0]
            k -= 1
         k >= 0 and fin < pair[k][0] k >= 0 k 0 fin < pair[k][0] fin pair[k][0] [k] pair k 0 area += pair[k][1] - pair[k][0] area pair[k][1] - pair[k][0] pair[k][1] [k] pair k 1 pair[k][0] [k] pair k 0 k -= 1 k 1 pond.append(area) pond.append pond append area tot += area tot area pond.append(len(pond)) pond.append pond append len(pond) len pond print(tot) print tot print(*pond[::-1]) print *pond[::-1] pond[::-1] pond ::-1 -1 if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    S = input()
    pair = []
    stack = [('%',-1)]
    for j,s in enumerate(S):
        if s == '/':
            if stack[-1][0] == '\\':
                i = stack[-1][1]
                stack.pop()
                pair.append((i,j))
        elif s == '_':
            continue
        else:
            stack.append((s,j))
    
    pond = []
    tot = 0
    k = len(pair) - 1
    while  k >= 0:
        fin = pair[k][0] - 1
        area = 0
        while k >= 0 and fin < pair[k][0]:
            area += pair[k][1] - pair[k][0]
            k -= 1
        pond.append(area)
        tot += area
    pond.append(len(pond))

    print(tot)
    print(*pond[::-1]) def main():
    S = input()
    pair = []
    stack = [('%',-1)]
    for j,s in enumerate(S):
        if s == '/':
            if stack[-1][0] == '\\':
                i = stack[-1][1]
                stack.pop()
                pair.append((i,j))
        elif s == '_':
            continue
        else:
            stack.append((s,j))
    
    pond = []
    tot = 0
    k = len(pair) - 1
    while  k >= 0:
        fin = pair[k][0] - 1
        area = 0
        while k >= 0 and fin < pair[k][0]:
            area += pair[k][1] - pair[k][0]
            k -= 1
        pond.append(area)
        tot += area
    pond.append(len(pond))

    print(tot)
    print(*pond[::-1]) main MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD INF = 10 ** 15 10 ** 15 INF
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    S = input()
    pair = []
    stack = [('%',-1)]
    for j,s in enumerate(S):
        if s == '/':
            if stack[-1][0] == '\\':
                i = stack[-1][1]
                stack.pop()
                pair.append((i,j))
        elif s == '_':
            continue
        else:
            stack.append((s,j))
    
    pond = []
    tot = 0
    k = len(pair) - 1
    while  k >= 0:
        fin = pair[k][0] - 1
        area = 0
        while k >= 0 and fin < pair[k][0]:
            area += pair[k][1] - pair[k][0]
            k -= 1
        pond.append(area)
        tot += area
    pond.append(len(pond))

    print(tot)
    print(*pond[::-1])
if __name__ == '__main__':
    main()
