from collections import deque
s = input()
S1 = deque()
S2 = deque()
total = 0
for i in range(len(s)):
    if s[i] == '\\':
        S1.append(i)
    elif s[i] == '/':
        if len(S1) != 0:
            a = S1.pop()
            total += i - a
            area = i - a
            if len(S2) != 0:
                while S2[-1][0] > a:
                    area += S2.pop()[1]
                    if len(S2) == 0:
                        break
                S2.append([a ,area])
            else:
                S2.append([a, area])
        else:
            pass
print(total)
if total == 0:
    print(0)
else:
    print(len(S2), ' '.join(map(lambda x: str(x[1]), S2))) from collections import deque s = input() s input() input S1 = deque() S1 deque() deque S2 = deque() S2 deque() deque total = 0 total 0 for i in range(len(s)):
    if s[i] == '\\':
        S1.append(i)
    elif s[i] == '/':
        if len(S1) != 0:
            a = S1.pop()
            total += i - a
            area = i - a
            if len(S2) != 0:
                while S2[-1][0] > a:
                    area += S2.pop()[1]
                    if len(S2) == 0:
                        break
                S2.append([a ,area])
            else:
                S2.append([a, area])
        else:
            pass i range(len(s)) range len(s) len s if s[i] == '\\':
        S1.append(i)
    elif s[i] == '/':
        if len(S1) != 0:
            a = S1.pop()
            total += i - a
            area = i - a
            if len(S2) != 0:
                while S2[-1][0] > a:
                    area += S2.pop()[1]
                    if len(S2) == 0:
                        break
                S2.append([a ,area])
            else:
                S2.append([a, area])
        else:
            pass s[i] == '\\' s[i] s i '\\' S1.append(i) S1.append S1 append i elif s[i] == '/':
        if len(S1) != 0:
            a = S1.pop()
            total += i - a
            area = i - a
            if len(S2) != 0:
                while S2[-1][0] > a:
                    area += S2.pop()[1]
                    if len(S2) == 0:
                        break
                S2.append([a ,area])
            else:
                S2.append([a, area])
        else:
            pass s[i] == '/' s[i] s i '/' if len(S1) != 0:
            a = S1.pop()
            total += i - a
            area = i - a
            if len(S2) != 0:
                while S2[-1][0] > a:
                    area += S2.pop()[1]
                    if len(S2) == 0:
                        break
                S2.append([a ,area])
            else:
                S2.append([a, area])
        else:
            pass len(S1) != 0 len(S1) len S1 0 a = S1.pop() a S1.pop() S1.pop S1 pop total += i - a total i - a i a area = i - a area i - a i a if len(S2) != 0:
                while S2[-1][0] > a:
                    area += S2.pop()[1]
                    if len(S2) == 0:
                        break
                S2.append([a ,area])
            else:
                S2.append([a, area])
         len(S2) != 0 len(S2) len S2 0 while S2[-1][0] > a:
                    area += S2.pop()[1]
                    if len(S2) == 0:
                        break
                 S2[-1][0] > a S2[-1][0] [-1] S2 -1 0 a area += S2.pop()[1] area S2.pop()[1] S2.pop() S2.pop S2 pop 1 if len(S2) == 0:
                        break
                 len(S2) == 0 len(S2) len S2 0 break S2.append([a ,area]) S2.append S2 append [a ,area] a area S2.append([a, area]) S2.append S2 append [a, area] a area print(total) print total if total == 0:
    print(0)
else:
    print(len(S2), ' '.join(map(lambda x: str(x[1]), S2))) total == 0 total 0 print(0) print 0 print(len(S2), ' '.join(map(lambda x: str(x[1]), S2))) print len(S2) len S2 ' '.join(map(lambda x: str(x[1]), S2)) ' '.join ' ' join map(lambda x: str(x[1]), S2) map lambda x: str(x[1]) str(x[1]) str x[1] x 1 x S2 total = 0 0 total area = i - a i - a area S1 = deque() deque() S1 s = input() input() s a = S1.pop() S1.pop() a area += S2.pop()[1] S2.pop()[1] area S2 = deque() deque() S2 total += i - a i - a total
from collections import deque
s = input()
S1 = deque()
S2 = deque()
total = 0
for i in range(len(s)):
    if s[i] == '\\':
        S1.append(i)
    elif s[i] == '/':
        if len(S1) != 0:
            a = S1.pop()
            total += i - a
            area = i - a
            if len(S2) != 0:
                while S2[-1][0] > a:
                    area += S2.pop()[1]
                    if len(S2) == 0:
                        break
                S2.append([a ,area])
            else:
                S2.append([a, area])
        else:
            pass
print(total)
if total == 0:
    print(0)
else:
    print(len(S2), ' '.join(map(lambda x: str(x[1]), S2)))
