import sys,itertools
from collections import deque

input = sys.stdin.readline


def _main():
    IN = input()
    area = 0
    all_area_stack = deque([])
    local_spot_stack = deque([])
    for i, op in enumerate(IN):
        if(op == '\\'):
            all_area_stack.append(i)
        elif(op == '/' and len(all_area_stack) > 0):
            i_p = all_area_stack.pop()
            area += (i - i_p)
            local_area = i - i_p
            while(len(local_spot_stack) > 0 and local_spot_stack[-1][0] > i_p):
                top_i, top_area = local_spot_stack.pop()
                local_area += top_area
            local_spot_stack.append((i, local_area))
    
    spots = [str(spot[1]) for spot in local_spot_stack]
    str_spots = ' '.join(spots)
    print(area)
    if(len(local_spot_stack) > 0):
        print('{} {}'.format(len(local_spot_stack), str_spots))
    else:
        print(0)





if __name__ == "__main__":
    _main() import sys,itertools sys itertools from collections import deque input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline def _main():
    IN = input()
    area = 0
    all_area_stack = deque([])
    local_spot_stack = deque([])
    for i, op in enumerate(IN):
        if(op == '\\'):
            all_area_stack.append(i)
        elif(op == '/' and len(all_area_stack) > 0):
            i_p = all_area_stack.pop()
            area += (i - i_p)
            local_area = i - i_p
            while(len(local_spot_stack) > 0 and local_spot_stack[-1][0] > i_p):
                top_i, top_area = local_spot_stack.pop()
                local_area += top_area
            local_spot_stack.append((i, local_area))
    
    spots = [str(spot[1]) for spot in local_spot_stack]
    str_spots = ' '.join(spots)
    print(area)
    if(len(local_spot_stack) > 0):
        print('{} {}'.format(len(local_spot_stack), str_spots))
    else:
        print(0) _main IN = input() IN input() input area = 0 area 0 all_area_stack = deque([]) all_area_stack deque([]) deque [] local_spot_stack = deque([]) local_spot_stack deque([]) deque [] for i, op in enumerate(IN):
        if(op == '\\'):
            all_area_stack.append(i)
        elif(op == '/' and len(all_area_stack) > 0):
            i_p = all_area_stack.pop()
            area += (i - i_p)
            local_area = i - i_p
            while(len(local_spot_stack) > 0 and local_spot_stack[-1][0] > i_p):
                top_i, top_area = local_spot_stack.pop()
                local_area += top_area
            local_spot_stack.append((i, local_area))
    
     i op enumerate(IN) enumerate IN if(op == '\\'):
            all_area_stack.append(i)
        elif(op == '/' and len(all_area_stack) > 0):
            i_p = all_area_stack.pop()
            area += (i - i_p)
            local_area = i - i_p
            while(len(local_spot_stack) > 0 and local_spot_stack[-1][0] > i_p):
                top_i, top_area = local_spot_stack.pop()
                local_area += top_area
            local_spot_stack.append((i, local_area))
    
     op == '\\' op '\\' all_area_stack.append(i) all_area_stack.append all_area_stack append i elif(op == '/' and len(all_area_stack) > 0):
            i_p = all_area_stack.pop()
            area += (i - i_p)
            local_area = i - i_p
            while(len(local_spot_stack) > 0 and local_spot_stack[-1][0] > i_p):
                top_i, top_area = local_spot_stack.pop()
                local_area += top_area
            local_spot_stack.append((i, local_area))
    
     op == '/' and len(all_area_stack) > 0 op == '/' op '/' len(all_area_stack) > 0 len(all_area_stack) len all_area_stack 0 i_p = all_area_stack.pop() i_p all_area_stack.pop() all_area_stack.pop all_area_stack pop area += (i - i_p) area i - i_p i i_p local_area = i - i_p local_area i - i_p i i_p while(len(local_spot_stack) > 0 and local_spot_stack[-1][0] > i_p):
                top_i, top_area = local_spot_stack.pop()
                local_area += top_area
             len(local_spot_stack) > 0 and local_spot_stack[-1][0] > i_p len(local_spot_stack) > 0 len(local_spot_stack) len local_spot_stack 0 local_spot_stack[-1][0] > i_p local_spot_stack[-1][0] [-1] local_spot_stack -1 0 i_p top_i, top_area = local_spot_stack.pop() top_i local_spot_stack.pop() local_spot_stack.pop local_spot_stack pop top_area local_area += top_area local_area top_area local_spot_stack.append((i, local_area)) local_spot_stack.append local_spot_stack append (i, local_area) i local_area str(spot[1]) for spot in local_spot_stack for spot in local_spot_stack spot local_spot_stack for spot in local_spot_stack str(spot[1]) str spot[1] spot 1 spots = [str(spot[1]) for spot in local_spot_stack] spots [str(spot[1]) for spot in local_spot_stack] str_spots = ' '.join(spots) str_spots ' '.join(spots) ' '.join ' ' join spots print(area) print area if(len(local_spot_stack) > 0):
        print('{} {}'.format(len(local_spot_stack), str_spots))
    else:
        print(0) len(local_spot_stack) > 0 len(local_spot_stack) len local_spot_stack 0 print('{} {}'.format(len(local_spot_stack), str_spots)) print '{} {}'.format(len(local_spot_stack), str_spots) '{} {}'.format '{} {}' format len(local_spot_stack) len local_spot_stack str_spots print(0) print 0 if __name__ == "__main__":
    _main() __name__ == "__main__" __name__ "__main__" _main() _main input = sys.stdin.readline sys.stdin.readline input def _main():
    IN = input()
    area = 0
    all_area_stack = deque([])
    local_spot_stack = deque([])
    for i, op in enumerate(IN):
        if(op == '\\'):
            all_area_stack.append(i)
        elif(op == '/' and len(all_area_stack) > 0):
            i_p = all_area_stack.pop()
            area += (i - i_p)
            local_area = i - i_p
            while(len(local_spot_stack) > 0 and local_spot_stack[-1][0] > i_p):
                top_i, top_area = local_spot_stack.pop()
                local_area += top_area
            local_spot_stack.append((i, local_area))
    
    spots = [str(spot[1]) for spot in local_spot_stack]
    str_spots = ' '.join(spots)
    print(area)
    if(len(local_spot_stack) > 0):
        print('{} {}'.format(len(local_spot_stack), str_spots))
    else:
        print(0) def _main():
    IN = input()
    area = 0
    all_area_stack = deque([])
    local_spot_stack = deque([])
    for i, op in enumerate(IN):
        if(op == '\\'):
            all_area_stack.append(i)
        elif(op == '/' and len(all_area_stack) > 0):
            i_p = all_area_stack.pop()
            area += (i - i_p)
            local_area = i - i_p
            while(len(local_spot_stack) > 0 and local_spot_stack[-1][0] > i_p):
                top_i, top_area = local_spot_stack.pop()
                local_area += top_area
            local_spot_stack.append((i, local_area))
    
    spots = [str(spot[1]) for spot in local_spot_stack]
    str_spots = ' '.join(spots)
    print(area)
    if(len(local_spot_stack) > 0):
        print('{} {}'.format(len(local_spot_stack), str_spots))
    else:
        print(0) _main
import sys,itertools
from collections import deque

input = sys.stdin.readline


def _main():
    IN = input()
    area = 0
    all_area_stack = deque([])
    local_spot_stack = deque([])
    for i, op in enumerate(IN):
        if(op == '\\'):
            all_area_stack.append(i)
        elif(op == '/' and len(all_area_stack) > 0):
            i_p = all_area_stack.pop()
            area += (i - i_p)
            local_area = i - i_p
            while(len(local_spot_stack) > 0 and local_spot_stack[-1][0] > i_p):
                top_i, top_area = local_spot_stack.pop()
                local_area += top_area
            local_spot_stack.append((i, local_area))
    
    spots = [str(spot[1]) for spot in local_spot_stack]
    str_spots = ' '.join(spots)
    print(area)
    if(len(local_spot_stack) > 0):
        print('{} {}'.format(len(local_spot_stack), str_spots))
    else:
        print(0)





if __name__ == "__main__":
    _main()
