from collections import deque

if __name__ == "__main__":
    slopes = input()
    total_area = 0
    slope_queue = deque()
    area_queue = deque()

    for i, slope in enumerate(slopes):
        if slope == '\\':
            slope_queue.append(i)
        elif slope == '/' and len(slope_queue) != 0:
            target = slope_queue.pop()
            area = i - target
            total_area += area
            if len(area_queue) == 0:
                area_queue.append((target, area))
            else:
                temp_area = area
                while True:
                    target_area = area_queue.pop()
                    if target < target_area[0]:
                        temp_area += target_area[1]
                        if len(area_queue) == 0:
                            area_queue.append((target, temp_area))
                            break
                    else:
                        area_queue.append(target_area)
                        area_queue.append((target, temp_area))
                        break

    print(total_area)
    if len(area_queue) == 0:
        print(len(area_queue), end='\n')
    else:
        print(len(area_queue), end=' ')
    for i, area in enumerate(area_queue):
        if i < len(area_queue) - 1:
            print(area[1], end=' ')
        else:
            print(area[1], end='\n') from collections import deque if __name__ == "__main__":
    slopes = input()
    total_area = 0
    slope_queue = deque()
    area_queue = deque()

    for i, slope in enumerate(slopes):
        if slope == '\\':
            slope_queue.append(i)
        elif slope == '/' and len(slope_queue) != 0:
            target = slope_queue.pop()
            area = i - target
            total_area += area
            if len(area_queue) == 0:
                area_queue.append((target, area))
            else:
                temp_area = area
                while True:
                    target_area = area_queue.pop()
                    if target < target_area[0]:
                        temp_area += target_area[1]
                        if len(area_queue) == 0:
                            area_queue.append((target, temp_area))
                            break
                    else:
                        area_queue.append(target_area)
                        area_queue.append((target, temp_area))
                        break

    print(total_area)
    if len(area_queue) == 0:
        print(len(area_queue), end='\n')
    else:
        print(len(area_queue), end=' ')
    for i, area in enumerate(area_queue):
        if i < len(area_queue) - 1:
            print(area[1], end=' ')
        else:
            print(area[1], end='\n') __name__ == "__main__" __name__ "__main__" slopes = input() slopes input() input total_area = 0 total_area 0 slope_queue = deque() slope_queue deque() deque area_queue = deque() area_queue deque() deque for i, slope in enumerate(slopes):
        if slope == '\\':
            slope_queue.append(i)
        elif slope == '/' and len(slope_queue) != 0:
            target = slope_queue.pop()
            area = i - target
            total_area += area
            if len(area_queue) == 0:
                area_queue.append((target, area))
            else:
                temp_area = area
                while True:
                    target_area = area_queue.pop()
                    if target < target_area[0]:
                        temp_area += target_area[1]
                        if len(area_queue) == 0:
                            area_queue.append((target, temp_area))
                            break
                    else:
                        area_queue.append(target_area)
                        area_queue.append((target, temp_area))
                        break

     i slope enumerate(slopes) enumerate slopes if slope == '\\':
            slope_queue.append(i)
        elif slope == '/' and len(slope_queue) != 0:
            target = slope_queue.pop()
            area = i - target
            total_area += area
            if len(area_queue) == 0:
                area_queue.append((target, area))
            else:
                temp_area = area
                while True:
                    target_area = area_queue.pop()
                    if target < target_area[0]:
                        temp_area += target_area[1]
                        if len(area_queue) == 0:
                            area_queue.append((target, temp_area))
                            break
                    else:
                        area_queue.append(target_area)
                        area_queue.append((target, temp_area))
                        break

     slope == '\\' slope '\\' slope_queue.append(i) slope_queue.append slope_queue append i elif slope == '/' and len(slope_queue) != 0:
            target = slope_queue.pop()
            area = i - target
            total_area += area
            if len(area_queue) == 0:
                area_queue.append((target, area))
            else:
                temp_area = area
                while True:
                    target_area = area_queue.pop()
                    if target < target_area[0]:
                        temp_area += target_area[1]
                        if len(area_queue) == 0:
                            area_queue.append((target, temp_area))
                            break
                    else:
                        area_queue.append(target_area)
                        area_queue.append((target, temp_area))
                        break

     slope == '/' and len(slope_queue) != 0 slope == '/' slope '/' len(slope_queue) != 0 len(slope_queue) len slope_queue 0 target = slope_queue.pop() target slope_queue.pop() slope_queue.pop slope_queue pop area = i - target area i - target i target total_area += area total_area area if len(area_queue) == 0:
                area_queue.append((target, area))
            else:
                temp_area = area
                while True:
                    target_area = area_queue.pop()
                    if target < target_area[0]:
                        temp_area += target_area[1]
                        if len(area_queue) == 0:
                            area_queue.append((target, temp_area))
                            break
                    else:
                        area_queue.append(target_area)
                        area_queue.append((target, temp_area))
                        break

     len(area_queue) == 0 len(area_queue) len area_queue 0 area_queue.append((target, area)) area_queue.append area_queue append (target, area) target area temp_area = area temp_area area while True:
                    target_area = area_queue.pop()
                    if target < target_area[0]:
                        temp_area += target_area[1]
                        if len(area_queue) == 0:
                            area_queue.append((target, temp_area))
                            break
                    else:
                        area_queue.append(target_area)
                        area_queue.append((target, temp_area))
                        break

     True target_area = area_queue.pop() target_area area_queue.pop() area_queue.pop area_queue pop if target < target_area[0]:
                        temp_area += target_area[1]
                        if len(area_queue) == 0:
                            area_queue.append((target, temp_area))
                            break
                    else:
                        area_queue.append(target_area)
                        area_queue.append((target, temp_area))
                        break

     target < target_area[0] target target_area[0] target_area 0 temp_area += target_area[1] temp_area target_area[1] target_area 1 if len(area_queue) == 0:
                            area_queue.append((target, temp_area))
                            break
                     len(area_queue) == 0 len(area_queue) len area_queue 0 area_queue.append((target, temp_area)) area_queue.append area_queue append (target, temp_area) target temp_area break area_queue.append(target_area) area_queue.append area_queue append target_area area_queue.append((target, temp_area)) area_queue.append area_queue append (target, temp_area) target temp_area break print(total_area) print total_area if len(area_queue) == 0:
        print(len(area_queue), end='\n')
    else:
        print(len(area_queue), end=' ')
     len(area_queue) == 0 len(area_queue) len area_queue 0 print(len(area_queue), end='\n') print len(area_queue) len area_queue end='\n' end '\n' print(len(area_queue), end=' ') print len(area_queue) len area_queue end=' ' end ' ' for i, area in enumerate(area_queue):
        if i < len(area_queue) - 1:
            print(area[1], end=' ')
        else:
            print(area[1], end='\n') i area enumerate(area_queue) enumerate area_queue if i < len(area_queue) - 1:
            print(area[1], end=' ')
        else:
            print(area[1], end='\n') i < len(area_queue) - 1 i len(area_queue) - 1 len(area_queue) len area_queue 1 print(area[1], end=' ') print area[1] area 1 end=' ' end ' ' print(area[1], end='\n') print area[1] area 1 end='\n' end '\n' area_queue = deque() deque() area_queue temp_area += target_area[1] target_area[1] temp_area total_area += area area total_area total_area = 0 0 total_area slope_queue = deque() deque() slope_queue target = slope_queue.pop() slope_queue.pop() target area = i - target i - target area temp_area = area area temp_area slopes = input() input() slopes target_area = area_queue.pop() area_queue.pop() target_area
from collections import deque

if __name__ == "__main__":
    slopes = input()
    total_area = 0
    slope_queue = deque()
    area_queue = deque()

    for i, slope in enumerate(slopes):
        if slope == '\\':
            slope_queue.append(i)
        elif slope == '/' and len(slope_queue) != 0:
            target = slope_queue.pop()
            area = i - target
            total_area += area
            if len(area_queue) == 0:
                area_queue.append((target, area))
            else:
                temp_area = area
                while True:
                    target_area = area_queue.pop()
                    if target < target_area[0]:
                        temp_area += target_area[1]
                        if len(area_queue) == 0:
                            area_queue.append((target, temp_area))
                            break
                    else:
                        area_queue.append(target_area)
                        area_queue.append((target, temp_area))
                        break

    print(total_area)
    if len(area_queue) == 0:
        print(len(area_queue), end='\n')
    else:
        print(len(area_queue), end=' ')
    for i, area in enumerate(area_queue):
        if i < len(area_queue) - 1:
            print(area[1], end=' ')
        else:
            print(area[1], end='\n')
