from collections import deque

slope = input()
down_slope   = deque()
total_slopes = deque()

for i in range(len(slope)):
    if slope[i] == '\\':
        down_slope.append(i)
    elif slope[i] == '/':
        area = 0
        if len(down_slope) > 0:
            while len(total_slopes) > 0 and total_slopes[-1][0] > down_slope[-1]:
                area += total_slopes[-1][1]
                total_slopes.pop()
            area += i-down_slope[-1]
            total_slopes.append([down_slope[-1],area])
            down_slope.pop()

if len(total_slopes) > 0:
    total_slopes = [i[1] for i in total_slopes]
    print(sum(total_slopes))
    print(len(total_slopes),end=' ')
    print(' '.join(map(str,total_slopes)))
else:
    print(0)
    print(0) from collections import deque slope = input() slope input() input down_slope   = deque() down_slope deque() deque total_slopes = deque() total_slopes deque() deque for i in range(len(slope)):
    if slope[i] == '\\':
        down_slope.append(i)
    elif slope[i] == '/':
        area = 0
        if len(down_slope) > 0:
            while len(total_slopes) > 0 and total_slopes[-1][0] > down_slope[-1]:
                area += total_slopes[-1][1]
                total_slopes.pop()
            area += i-down_slope[-1]
            total_slopes.append([down_slope[-1],area])
            down_slope.pop() i range(len(slope)) range len(slope) len slope if slope[i] == '\\':
        down_slope.append(i)
    elif slope[i] == '/':
        area = 0
        if len(down_slope) > 0:
            while len(total_slopes) > 0 and total_slopes[-1][0] > down_slope[-1]:
                area += total_slopes[-1][1]
                total_slopes.pop()
            area += i-down_slope[-1]
            total_slopes.append([down_slope[-1],area])
            down_slope.pop() slope[i] == '\\' slope[i] slope i '\\' down_slope.append(i) down_slope.append down_slope append i elif slope[i] == '/':
        area = 0
        if len(down_slope) > 0:
            while len(total_slopes) > 0 and total_slopes[-1][0] > down_slope[-1]:
                area += total_slopes[-1][1]
                total_slopes.pop()
            area += i-down_slope[-1]
            total_slopes.append([down_slope[-1],area])
            down_slope.pop() slope[i] == '/' slope[i] slope i '/' area = 0 area 0 if len(down_slope) > 0:
            while len(total_slopes) > 0 and total_slopes[-1][0] > down_slope[-1]:
                area += total_slopes[-1][1]
                total_slopes.pop()
            area += i-down_slope[-1]
            total_slopes.append([down_slope[-1],area])
            down_slope.pop() len(down_slope) > 0 len(down_slope) len down_slope 0 while len(total_slopes) > 0 and total_slopes[-1][0] > down_slope[-1]:
                area += total_slopes[-1][1]
                total_slopes.pop()
             len(total_slopes) > 0 and total_slopes[-1][0] > down_slope[-1] len(total_slopes) > 0 len(total_slopes) len total_slopes 0 total_slopes[-1][0] > down_slope[-1] total_slopes[-1][0] [-1] total_slopes -1 0 down_slope[-1] down_slope -1 area += total_slopes[-1][1] area total_slopes[-1][1] [-1] total_slopes -1 1 total_slopes.pop() total_slopes.pop total_slopes pop area += i-down_slope[-1] area i-down_slope[-1] i down_slope[-1] down_slope -1 total_slopes.append([down_slope[-1],area]) total_slopes.append total_slopes append [down_slope[-1],area] down_slope[-1] down_slope -1 area down_slope.pop() down_slope.pop down_slope pop if len(total_slopes) > 0:
    total_slopes = [i[1] for i in total_slopes]
    print(sum(total_slopes))
    print(len(total_slopes),end=' ')
    print(' '.join(map(str,total_slopes)))
else:
    print(0)
    print(0) len(total_slopes) > 0 len(total_slopes) len total_slopes 0 i[1] for i in total_slopes for i in total_slopes i total_slopes for i in total_slopes i[1] i 1 total_slopes = [i[1] for i in total_slopes] total_slopes [i[1] for i in total_slopes] print(sum(total_slopes)) print sum(total_slopes) sum total_slopes print(len(total_slopes),end=' ') print len(total_slopes) len total_slopes end=' ' end ' ' print(' '.join(map(str,total_slopes))) print ' '.join(map(str,total_slopes)) ' '.join ' ' join map(str,total_slopes) map str total_slopes print(0) print 0 print(0) print 0 area += i-down_slope[-1] i-down_slope[-1] area total_slopes = [i[1] for i in total_slopes] [i[1] for i in total_slopes] total_slopes area = 0 0 area area += total_slopes[-1][1] total_slopes[-1][1] area total_slopes = deque() deque() total_slopes slope = input() input() slope down_slope   = deque() deque() down_slope
from collections import deque

slope = input()
down_slope   = deque()
total_slopes = deque()

for i in range(len(slope)):
    if slope[i] == '\\':
        down_slope.append(i)
    elif slope[i] == '/':
        area = 0
        if len(down_slope) > 0:
            while len(total_slopes) > 0 and total_slopes[-1][0] > down_slope[-1]:
                area += total_slopes[-1][1]
                total_slopes.pop()
            area += i-down_slope[-1]
            total_slopes.append([down_slope[-1],area])
            down_slope.pop()

if len(total_slopes) > 0:
    total_slopes = [i[1] for i in total_slopes]
    print(sum(total_slopes))
    print(len(total_slopes),end=' ')
    print(' '.join(map(str,total_slopes)))
else:
    print(0)
    print(0)
