def print_list_split_whitespace(a):
    for x in a[:-1]:
        print(x, end=' ')
    print(a[-1])
    
s = list(input())
st1 = []
st2 = []

for index, c in enumerate(s):
    if c == "\\":
        st1.append(index)
    elif c == "/":
        if len(st1) >= 1:
            pop_index = st1.pop()
            area = index - pop_index
            while True:
                if len(st2) >= 1:
                    ind, pop_area = st2.pop()
                else:
                    st2.append((index, area))
                    break
                if ind < pop_index:
                    st2.append((ind, pop_area))
                    st2.append((index, area))
                    break
                else:
                    area += pop_area

a = 0
k = len(st2)
ls = [k]
for _, s in st2:
    a += s
    ls.append(s)

print(a)
print_list_split_whitespace(ls) def print_list_split_whitespace(a):
    for x in a[:-1]:
        print(x, end=' ')
    print(a[-1])
     print_list_split_whitespace for x in a[:-1]:
        print(x, end=' ')
     x a[:-1] a :-1 -1 print(x, end=' ') print x end=' ' end ' ' print(a[-1]) print a[-1] a -1 a a s = list(input()) s list(input()) list input() input st1 = [] st1 [] st2 = [] st2 [] for index, c in enumerate(s):
    if c == "\\":
        st1.append(index)
    elif c == "/":
        if len(st1) >= 1:
            pop_index = st1.pop()
            area = index - pop_index
            while True:
                if len(st2) >= 1:
                    ind, pop_area = st2.pop()
                else:
                    st2.append((index, area))
                    break
                if ind < pop_index:
                    st2.append((ind, pop_area))
                    st2.append((index, area))
                    break
                else:
                    area += pop_area index c enumerate(s) enumerate s if c == "\\":
        st1.append(index)
    elif c == "/":
        if len(st1) >= 1:
            pop_index = st1.pop()
            area = index - pop_index
            while True:
                if len(st2) >= 1:
                    ind, pop_area = st2.pop()
                else:
                    st2.append((index, area))
                    break
                if ind < pop_index:
                    st2.append((ind, pop_area))
                    st2.append((index, area))
                    break
                else:
                    area += pop_area c == "\\" c "\\" st1.append(index) st1.append st1 append index elif c == "/":
        if len(st1) >= 1:
            pop_index = st1.pop()
            area = index - pop_index
            while True:
                if len(st2) >= 1:
                    ind, pop_area = st2.pop()
                else:
                    st2.append((index, area))
                    break
                if ind < pop_index:
                    st2.append((ind, pop_area))
                    st2.append((index, area))
                    break
                else:
                    area += pop_area c == "/" c "/" if len(st1) >= 1:
            pop_index = st1.pop()
            area = index - pop_index
            while True:
                if len(st2) >= 1:
                    ind, pop_area = st2.pop()
                else:
                    st2.append((index, area))
                    break
                if ind < pop_index:
                    st2.append((ind, pop_area))
                    st2.append((index, area))
                    break
                else:
                    area += pop_area len(st1) >= 1 len(st1) len st1 1 pop_index = st1.pop() pop_index st1.pop() st1.pop st1 pop area = index - pop_index area index - pop_index index pop_index while True:
                if len(st2) >= 1:
                    ind, pop_area = st2.pop()
                else:
                    st2.append((index, area))
                    break
                if ind < pop_index:
                    st2.append((ind, pop_area))
                    st2.append((index, area))
                    break
                else:
                    area += pop_area True if len(st2) >= 1:
                    ind, pop_area = st2.pop()
                else:
                    st2.append((index, area))
                    break
                 len(st2) >= 1 len(st2) len st2 1 ind, pop_area = st2.pop() ind st2.pop() st2.pop st2 pop pop_area st2.append((index, area)) st2.append st2 append (index, area) index area break if ind < pop_index:
                    st2.append((ind, pop_area))
                    st2.append((index, area))
                    break
                else:
                    area += pop_area ind < pop_index ind pop_index st2.append((ind, pop_area)) st2.append st2 append (ind, pop_area) ind pop_area st2.append((index, area)) st2.append st2 append (index, area) index area break area += pop_area area pop_area a = 0 a 0 k = len(st2) k len(st2) len st2 ls = [k] ls [k] k for _, s in st2:
    a += s
    ls.append(s) _ s st2 a += s a s ls.append(s) ls.append ls append s print(a) print a print_list_split_whitespace(ls) print_list_split_whitespace ls s = list(input()) list(input()) s ls = [k] [k] ls k = len(st2) len(st2) k st1 = [] [] st1 st2 = [] [] st2 a += s s a pop_index = st1.pop() st1.pop() pop_index a = 0 0 a ind, pop_area = st2.pop() st2.pop() ind area += pop_area pop_area area def print_list_split_whitespace(a):
    for x in a[:-1]:
        print(x, end=' ')
    print(a[-1])
     def print_list_split_whitespace(a):
    for x in a[:-1]:
        print(x, end=' ')
    print(a[-1])
     print_list_split_whitespace pop_area = st2.pop() st2.pop() pop_area area = index - pop_index index - pop_index area
def print_list_split_whitespace(a):
    for x in a[:-1]:
        print(x, end=' ')
    print(a[-1])
    
s = list(input())
st1 = []
st2 = []

for index, c in enumerate(s):
    if c == "\\":
        st1.append(index)
    elif c == "/":
        if len(st1) >= 1:
            pop_index = st1.pop()
            area = index - pop_index
            while True:
                if len(st2) >= 1:
                    ind, pop_area = st2.pop()
                else:
                    st2.append((index, area))
                    break
                if ind < pop_index:
                    st2.append((ind, pop_area))
                    st2.append((index, area))
                    break
                else:
                    area += pop_area

a = 0
k = len(st2)
ls = [k]
for _, s in st2:
    a += s
    ls.append(s)

print(a)
print_list_split_whitespace(ls)
