import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from collections import deque
A = S()
Down = deque([])
S = deque([])

for i in range(len(A)):
    if A[i] == '\\':
        Down.append(i)
    elif A[i] == '/' and len(Down) != 0:
        j = Down.pop()
        a = i - j
        while len(S) > 0 and S[-1][0] > j:
            a += S.pop()[1]
        S.append((j, a))
ans = []
for i in range(len(S)):
    ans.append(S[i][1])
print(sum(ans))
ans.insert(0, len(ans))
print(' '.join(map(str, ans))) import bisect, collections, copy, heapq, itertools, math, string bisect collections copy heapq itertools math string import sys sys def I(): return int(sys.stdin.readline().rstrip()) I def MI(): return map(int, sys.stdin.readline().rstrip().split()) MI def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) LI def S(): return sys.stdin.readline().rstrip() S def LS(): return list(sys.stdin.readline().rstrip().split()) LS from collections import deque A = S() A S() S Down = deque([]) Down deque([]) deque [] S = deque([]) S deque([]) deque [] for i in range(len(A)):
    if A[i] == '\\':
        Down.append(i)
    elif A[i] == '/' and len(Down) != 0:
        j = Down.pop()
        a = i - j
        while len(S) > 0 and S[-1][0] > j:
            a += S.pop()[1]
        S.append((j, a)) i range(len(A)) range len(A) len A if A[i] == '\\':
        Down.append(i)
    elif A[i] == '/' and len(Down) != 0:
        j = Down.pop()
        a = i - j
        while len(S) > 0 and S[-1][0] > j:
            a += S.pop()[1]
        S.append((j, a)) A[i] == '\\' A[i] A i '\\' Down.append(i) Down.append Down append i elif A[i] == '/' and len(Down) != 0:
        j = Down.pop()
        a = i - j
        while len(S) > 0 and S[-1][0] > j:
            a += S.pop()[1]
        S.append((j, a)) A[i] == '/' and len(Down) != 0 A[i] == '/' A[i] A i '/' len(Down) != 0 len(Down) len Down 0 j = Down.pop() j Down.pop() Down.pop Down pop a = i - j a i - j i j while len(S) > 0 and S[-1][0] > j:
            a += S.pop()[1]
         len(S) > 0 and S[-1][0] > j len(S) > 0 len(S) len S 0 S[-1][0] > j S[-1][0] [-1] S -1 0 j a += S.pop()[1] a S.pop()[1] S.pop() S.pop S pop 1 S.append((j, a)) S.append S append (j, a) j a ans = [] ans [] for i in range(len(S)):
    ans.append(S[i][1]) i range(len(S)) range len(S) len S ans.append(S[i][1]) ans.append ans append S[i][1] [i] S i 1 print(sum(ans)) print sum(ans) sum ans ans.insert(0, len(ans)) ans.insert ans insert 0 len(ans) len ans print(' '.join(map(str, ans))) print ' '.join(map(str, ans)) ' '.join ' ' join map(str, ans) map str ans Down = deque([]) deque([]) Down def I(): return int(sys.stdin.readline().rstrip()) def I(): return int(sys.stdin.readline().rstrip()) I def LS(): return list(sys.stdin.readline().rstrip().split()) def LS(): return list(sys.stdin.readline().rstrip().split()) LS ans = [] [] ans a = i - j i - j a a += S.pop()[1] S.pop()[1] a def MI(): return map(int, sys.stdin.readline().rstrip().split()) def MI(): return map(int, sys.stdin.readline().rstrip().split()) MI def S(): return sys.stdin.readline().rstrip() def S(): return sys.stdin.readline().rstrip() S S = deque([]) deque([]) S def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) LI j = Down.pop() Down.pop() j A = S() S() A
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from collections import deque
A = S()
Down = deque([])
S = deque([])

for i in range(len(A)):
    if A[i] == '\\':
        Down.append(i)
    elif A[i] == '/' and len(Down) != 0:
        j = Down.pop()
        a = i - j
        while len(S) > 0 and S[-1][0] > j:
            a += S.pop()[1]
        S.append((j, a))
ans = []
for i in range(len(S)):
    ans.append(S[i][1])
print(sum(ans))
ans.insert(0, len(ans))
print(' '.join(map(str, ans)))
