def hightMapGenerator(text):
    height_map = []
    current_height = 0
    for letter in text:
        if letter == '\\':
            current_height -= 1
        elif letter == '/':
            current_height += 1
        else :
            pass
        height_map.append(current_height)
    return height_map

def pondChecker(text, height_map):
    # 判定
    all_ponds = []
    pond = []
    for n, letter in enumerate(text):
        if pond == []: # 池オブジェクトが空の場合
            if letter == '\\': # かつ、文字列がa の場合
                max_height = max(height_map[n:])
                if height_map[n] + 1 <= max_height: # 現在地よりも、高度の高い位置があるならば
                    start_index = n
                    pond.append(start_index) # スタート位置としてインデックスする
                else :
                    pass
        else : # 池オブジェクとにスタートが入っている場合
            if height_map[start_index] + 1 == height_map[n]: # スタートインデックスと同じ高さに来たら終わりをインデックスして、初期化
                end_index = n
                pond.append(end_index)
                all_ponds.append(pond)
                pond = []
    return all_ponds
    
def squareCalc(text, pond_height_map):
    square = 0
    current_height = max(pond_height_map)
    for n, letter in enumerate(text):
        if letter == '\\':
            square += current_height - pond_height_map[n] - 0.5
        elif letter == '/':
            square += current_height - pond_height_map[n] + 0.5
        else :
            square += current_height - pond_height_map[n]
    return int(square)

def slicedPondsGenerator(text, height_map, all_ponds):
    sliced_ponds_str = []
    sliced_height_map = []
    for pond in all_ponds:
        start = pond[0]
        end = pond[1] + 1
        sliced_pond_str = text[start:end]
        sliced_height = height_map[start:end]
        sliced_ponds_str.append(sliced_pond_str)
        sliced_height_map.append(sliced_height)
    return sliced_ponds_str, sliced_height_map

text = input()

if '/' not in text:
    print(0)
    print(0)
elif '\\' not in text:
    print(0)
    print(0)
else :
    height_map = hightMapGenerator(text)
    # print(height_map)
    all_ponds = pondChecker(text, height_map)
    if all_ponds == []:
        print(0)
        print(0)
    else :
        # print(all_ponds)
        sliced_ponds_str, sliced_height_map = slicedPondsGenerator(text, height_map, all_ponds)
        # print(ponds_str)
        # print(sliced_height_map)
        squares = []
        for n, pond_str in enumerate(sliced_ponds_str):
            square = squareCalc(pond_str, sliced_height_map[n])
            squares.append(square)

        size_of_ponds = sum(squares)
        num_of_ponds = len(squares)
        output = ' '.join([str(n) for n in squares])
        print(size_of_ponds)
        print(num_of_ponds,output) def hightMapGenerator(text):
    height_map = []
    current_height = 0
    for letter in text:
        if letter == '\\':
            current_height -= 1
        elif letter == '/':
            current_height += 1
        else :
            pass
        height_map.append(current_height)
    return height_map hightMapGenerator height_map = [] height_map [] current_height = 0 current_height 0 for letter in text:
        if letter == '\\':
            current_height -= 1
        elif letter == '/':
            current_height += 1
        else :
            pass
        height_map.append(current_height)
     letter text if letter == '\\':
            current_height -= 1
        elif letter == '/':
            current_height += 1
        else :
            pass
         letter == '\\' letter '\\' current_height -= 1 current_height 1 elif letter == '/':
            current_height += 1
         letter == '/' letter '/' current_height += 1 current_height 1 height_map.append(current_height) height_map.append height_map append current_height return height_map height_map text text def pondChecker(text, height_map):
    # 判定
    all_ponds = []
    pond = []
    for n, letter in enumerate(text):
        if pond == []: # 池オブジェクトが空の場合
            if letter == '\\': # かつ、文字列がa の場合
                max_height = max(height_map[n:])
                if height_map[n] + 1 <= max_height: # 現在地よりも、高度の高い位置があるならば
                    start_index = n
                    pond.append(start_index) # スタート位置としてインデックスする
                else :
                    pass
        else : # 池オブジェクとにスタートが入っている場合
            if height_map[start_index] + 1 == height_map[n]: # スタートインデックスと同じ高さに来たら終わりをインデックスして、初期化
                end_index = n
                pond.append(end_index)
                all_ponds.append(pond)
                pond = []
    return all_ponds
     pondChecker all_ponds = [] all_ponds [] pond = [] pond [] for n, letter in enumerate(text):
        if pond == []: # 池オブジェクトが空の場合
            if letter == '\\': # かつ、文字列がa の場合
                max_height = max(height_map[n:])
                if height_map[n] + 1 <= max_height: # 現在地よりも、高度の高い位置があるならば
                    start_index = n
                    pond.append(start_index) # スタート位置としてインデックスする
                else :
                    pass
        else : # 池オブジェクとにスタートが入っている場合
            if height_map[start_index] + 1 == height_map[n]: # スタートインデックスと同じ高さに来たら終わりをインデックスして、初期化
                end_index = n
                pond.append(end_index)
                all_ponds.append(pond)
                pond = []
     n letter enumerate(text) enumerate text if pond == []: # 池オブジェクトが空の場合
            if letter == '\\': # かつ、文字列がa の場合
                max_height = max(height_map[n:])
                if height_map[n] + 1 <= max_height: # 現在地よりも、高度の高い位置があるならば
                    start_index = n
                    pond.append(start_index) # スタート位置としてインデックスする
                else :
                    pass
        else : # 池オブジェクとにスタートが入っている場合
            if height_map[start_index] + 1 == height_map[n]: # スタートインデックスと同じ高さに来たら終わりをインデックスして、初期化
                end_index = n
                pond.append(end_index)
                all_ponds.append(pond)
                pond = []
     pond == [] pond [] if letter == '\\': # かつ、文字列がa の場合
                max_height = max(height_map[n:])
                if height_map[n] + 1 <= max_height: # 現在地よりも、高度の高い位置があるならば
                    start_index = n
                    pond.append(start_index) # スタート位置としてインデックスする
                else :
                    pass
         letter == '\\' letter '\\' max_height = max(height_map[n:]) max_height max(height_map[n:]) max height_map[n:] height_map n: n if height_map[n] + 1 <= max_height: # 現在地よりも、高度の高い位置があるならば
                    start_index = n
                    pond.append(start_index) # スタート位置としてインデックスする
                else :
                    pass
         height_map[n] + 1 <= max_height height_map[n] + 1 height_map[n] height_map n 1 max_height start_index = n start_index n pond.append(start_index) pond.append pond append start_index if height_map[start_index] + 1 == height_map[n]: # スタートインデックスと同じ高さに来たら終わりをインデックスして、初期化
                end_index = n
                pond.append(end_index)
                all_ponds.append(pond)
                pond = []
     height_map[start_index] + 1 == height_map[n] height_map[start_index] + 1 height_map[start_index] height_map start_index 1 height_map[n] height_map n end_index = n end_index n pond.append(end_index) pond.append pond append end_index all_ponds.append(pond) all_ponds.append all_ponds append pond pond = [] pond [] return all_ponds all_ponds text text height_map height_map def squareCalc(text, pond_height_map):
    square = 0
    current_height = max(pond_height_map)
    for n, letter in enumerate(text):
        if letter == '\\':
            square += current_height - pond_height_map[n] - 0.5
        elif letter == '/':
            square += current_height - pond_height_map[n] + 0.5
        else :
            square += current_height - pond_height_map[n]
    return int(square) squareCalc square = 0 square 0 current_height = max(pond_height_map) current_height max(pond_height_map) max pond_height_map for n, letter in enumerate(text):
        if letter == '\\':
            square += current_height - pond_height_map[n] - 0.5
        elif letter == '/':
            square += current_height - pond_height_map[n] + 0.5
        else :
            square += current_height - pond_height_map[n]
     n letter enumerate(text) enumerate text if letter == '\\':
            square += current_height - pond_height_map[n] - 0.5
        elif letter == '/':
            square += current_height - pond_height_map[n] + 0.5
        else :
            square += current_height - pond_height_map[n]
     letter == '\\' letter '\\' square += current_height - pond_height_map[n] - 0.5 square current_height - pond_height_map[n] - 0.5 current_height - pond_height_map[n] current_height pond_height_map[n] pond_height_map n 0.5 elif letter == '/':
            square += current_height - pond_height_map[n] + 0.5
         letter == '/' letter '/' square += current_height - pond_height_map[n] + 0.5 square current_height - pond_height_map[n] + 0.5 current_height - pond_height_map[n] current_height pond_height_map[n] pond_height_map n 0.5 square += current_height - pond_height_map[n] square current_height - pond_height_map[n] current_height pond_height_map[n] pond_height_map n return int(square) int(square) int square text text pond_height_map pond_height_map def slicedPondsGenerator(text, height_map, all_ponds):
    sliced_ponds_str = []
    sliced_height_map = []
    for pond in all_ponds:
        start = pond[0]
        end = pond[1] + 1
        sliced_pond_str = text[start:end]
        sliced_height = height_map[start:end]
        sliced_ponds_str.append(sliced_pond_str)
        sliced_height_map.append(sliced_height)
    return sliced_ponds_str, sliced_height_map slicedPondsGenerator sliced_ponds_str = [] sliced_ponds_str [] sliced_height_map = [] sliced_height_map [] for pond in all_ponds:
        start = pond[0]
        end = pond[1] + 1
        sliced_pond_str = text[start:end]
        sliced_height = height_map[start:end]
        sliced_ponds_str.append(sliced_pond_str)
        sliced_height_map.append(sliced_height)
     pond all_ponds start = pond[0] start pond[0] pond 0 end = pond[1] + 1 end pond[1] + 1 pond[1] pond 1 1 sliced_pond_str = text[start:end] sliced_pond_str text[start:end] text start:end start end sliced_height = height_map[start:end] sliced_height height_map[start:end] height_map start:end start end sliced_ponds_str.append(sliced_pond_str) sliced_ponds_str.append sliced_ponds_str append sliced_pond_str sliced_height_map.append(sliced_height) sliced_height_map.append sliced_height_map append sliced_height return sliced_ponds_str, sliced_height_map return sliced_ponds_str, sliced_height_map sliced_ponds_str sliced_height_map text text height_map height_map all_ponds all_ponds text = input() text input() input if '/' not in text:
    print(0)
    print(0)
elif '\\' not in text:
    print(0)
    print(0)
else :
    height_map = hightMapGenerator(text)
    # print(height_map)
    all_ponds = pondChecker(text, height_map)
    if all_ponds == []:
        print(0)
        print(0)
    else :
        # print(all_ponds)
        sliced_ponds_str, sliced_height_map = slicedPondsGenerator(text, height_map, all_ponds)
        # print(ponds_str)
        # print(sliced_height_map)
        squares = []
        for n, pond_str in enumerate(sliced_ponds_str):
            square = squareCalc(pond_str, sliced_height_map[n])
            squares.append(square)

        size_of_ponds = sum(squares)
        num_of_ponds = len(squares)
        output = ' '.join([str(n) for n in squares])
        print(size_of_ponds)
        print(num_of_ponds,output) '/' not in text '/' text print(0) print 0 print(0) print 0 elif '\\' not in text:
    print(0)
    print(0) '\\' not in text '\\' text print(0) print 0 print(0) print 0 height_map = hightMapGenerator(text) height_map hightMapGenerator(text) hightMapGenerator text all_ponds = pondChecker(text, height_map) all_ponds pondChecker(text, height_map) pondChecker text height_map if all_ponds == []:
        print(0)
        print(0)
    else :
        # print(all_ponds)
        sliced_ponds_str, sliced_height_map = slicedPondsGenerator(text, height_map, all_ponds)
        # print(ponds_str)
        # print(sliced_height_map)
        squares = []
        for n, pond_str in enumerate(sliced_ponds_str):
            square = squareCalc(pond_str, sliced_height_map[n])
            squares.append(square)

        size_of_ponds = sum(squares)
        num_of_ponds = len(squares)
        output = ' '.join([str(n) for n in squares])
        print(size_of_ponds)
        print(num_of_ponds,output) all_ponds == [] all_ponds [] print(0) print 0 print(0) print 0 sliced_ponds_str, sliced_height_map = slicedPondsGenerator(text, height_map, all_ponds) sliced_ponds_str slicedPondsGenerator(text, height_map, all_ponds) slicedPondsGenerator text height_map all_ponds sliced_height_map squares = [] squares [] for n, pond_str in enumerate(sliced_ponds_str):
            square = squareCalc(pond_str, sliced_height_map[n])
            squares.append(square)

         n pond_str enumerate(sliced_ponds_str) enumerate sliced_ponds_str square = squareCalc(pond_str, sliced_height_map[n]) square squareCalc(pond_str, sliced_height_map[n]) squareCalc pond_str sliced_height_map[n] sliced_height_map n squares.append(square) squares.append squares append square size_of_ponds = sum(squares) size_of_ponds sum(squares) sum squares num_of_ponds = len(squares) num_of_ponds len(squares) len squares str(n) for n in squares for n in squares n squares for n in squares str(n) str n output = ' '.join([str(n) for n in squares]) output ' '.join([str(n) for n in squares]) ' '.join ' ' join [str(n) for n in squares] print(size_of_ponds) print size_of_ponds print(num_of_ponds,output) print num_of_ponds output all_ponds = pondChecker(text, height_map) pondChecker(text, height_map) all_ponds def slicedPondsGenerator(text, height_map, all_ponds):
    sliced_ponds_str = []
    sliced_height_map = []
    for pond in all_ponds:
        start = pond[0]
        end = pond[1] + 1
        sliced_pond_str = text[start:end]
        sliced_height = height_map[start:end]
        sliced_ponds_str.append(sliced_pond_str)
        sliced_height_map.append(sliced_height)
    return sliced_ponds_str, sliced_height_map def slicedPondsGenerator(text, height_map, all_ponds):
    sliced_ponds_str = []
    sliced_height_map = []
    for pond in all_ponds:
        start = pond[0]
        end = pond[1] + 1
        sliced_pond_str = text[start:end]
        sliced_height = height_map[start:end]
        sliced_ponds_str.append(sliced_pond_str)
        sliced_height_map.append(sliced_height)
    return sliced_ponds_str, sliced_height_map slicedPondsGenerator squares = [] [] squares sliced_ponds_str, sliced_height_map = slicedPondsGenerator(text, height_map, all_ponds) slicedPondsGenerator(text, height_map, all_ponds) sliced_ponds_str def squareCalc(text, pond_height_map):
    square = 0
    current_height = max(pond_height_map)
    for n, letter in enumerate(text):
        if letter == '\\':
            square += current_height - pond_height_map[n] - 0.5
        elif letter == '/':
            square += current_height - pond_height_map[n] + 0.5
        else :
            square += current_height - pond_height_map[n]
    return int(square) def squareCalc(text, pond_height_map):
    square = 0
    current_height = max(pond_height_map)
    for n, letter in enumerate(text):
        if letter == '\\':
            square += current_height - pond_height_map[n] - 0.5
        elif letter == '/':
            square += current_height - pond_height_map[n] + 0.5
        else :
            square += current_height - pond_height_map[n]
    return int(square) squareCalc size_of_ponds = sum(squares) sum(squares) size_of_ponds def pondChecker(text, height_map):
    # 判定
    all_ponds = []
    pond = []
    for n, letter in enumerate(text):
        if pond == []: # 池オブジェクトが空の場合
            if letter == '\\': # かつ、文字列がa の場合
                max_height = max(height_map[n:])
                if height_map[n] + 1 <= max_height: # 現在地よりも、高度の高い位置があるならば
                    start_index = n
                    pond.append(start_index) # スタート位置としてインデックスする
                else :
                    pass
        else : # 池オブジェクとにスタートが入っている場合
            if height_map[start_index] + 1 == height_map[n]: # スタートインデックスと同じ高さに来たら終わりをインデックスして、初期化
                end_index = n
                pond.append(end_index)
                all_ponds.append(pond)
                pond = []
    return all_ponds
     def pondChecker(text, height_map):
    # 判定
    all_ponds = []
    pond = []
    for n, letter in enumerate(text):
        if pond == []: # 池オブジェクトが空の場合
            if letter == '\\': # かつ、文字列がa の場合
                max_height = max(height_map[n:])
                if height_map[n] + 1 <= max_height: # 現在地よりも、高度の高い位置があるならば
                    start_index = n
                    pond.append(start_index) # スタート位置としてインデックスする
                else :
                    pass
        else : # 池オブジェクとにスタートが入っている場合
            if height_map[start_index] + 1 == height_map[n]: # スタートインデックスと同じ高さに来たら終わりをインデックスして、初期化
                end_index = n
                pond.append(end_index)
                all_ponds.append(pond)
                pond = []
    return all_ponds
     pondChecker output = ' '.join([str(n) for n in squares]) ' '.join([str(n) for n in squares]) output height_map = hightMapGenerator(text) hightMapGenerator(text) height_map num_of_ponds = len(squares) len(squares) num_of_ponds square = squareCalc(pond_str, sliced_height_map[n]) squareCalc(pond_str, sliced_height_map[n]) square def hightMapGenerator(text):
    height_map = []
    current_height = 0
    for letter in text:
        if letter == '\\':
            current_height -= 1
        elif letter == '/':
            current_height += 1
        else :
            pass
        height_map.append(current_height)
    return height_map def hightMapGenerator(text):
    height_map = []
    current_height = 0
    for letter in text:
        if letter == '\\':
            current_height -= 1
        elif letter == '/':
            current_height += 1
        else :
            pass
        height_map.append(current_height)
    return height_map hightMapGenerator sliced_height_map = slicedPondsGenerator(text, height_map, all_ponds) slicedPondsGenerator(text, height_map, all_ponds) sliced_height_map text = input() input() text
def hightMapGenerator(text):
    height_map = []
    current_height = 0
    for letter in text:
        if letter == '\\':
            current_height -= 1
        elif letter == '/':
            current_height += 1
        else :
            pass
        height_map.append(current_height)
    return height_map

def pondChecker(text, height_map):
    # 判定
    all_ponds = []
    pond = []
    for n, letter in enumerate(text):
        if pond == []: # 池オブジェクトが空の場合
            if letter == '\\': # かつ、文字列がa の場合
                max_height = max(height_map[n:])
                if height_map[n] + 1 <= max_height: # 現在地よりも、高度の高い位置があるならば
                    start_index = n
                    pond.append(start_index) # スタート位置としてインデックスする
                else :
                    pass
        else : # 池オブジェクとにスタートが入っている場合
            if height_map[start_index] + 1 == height_map[n]: # スタートインデックスと同じ高さに来たら終わりをインデックスして、初期化
                end_index = n
                pond.append(end_index)
                all_ponds.append(pond)
                pond = []
    return all_ponds
    
def squareCalc(text, pond_height_map):
    square = 0
    current_height = max(pond_height_map)
    for n, letter in enumerate(text):
        if letter == '\\':
            square += current_height - pond_height_map[n] - 0.5
        elif letter == '/':
            square += current_height - pond_height_map[n] + 0.5
        else :
            square += current_height - pond_height_map[n]
    return int(square)

def slicedPondsGenerator(text, height_map, all_ponds):
    sliced_ponds_str = []
    sliced_height_map = []
    for pond in all_ponds:
        start = pond[0]
        end = pond[1] + 1
        sliced_pond_str = text[start:end]
        sliced_height = height_map[start:end]
        sliced_ponds_str.append(sliced_pond_str)
        sliced_height_map.append(sliced_height)
    return sliced_ponds_str, sliced_height_map

text = input()

if '/' not in text:
    print(0)
    print(0)
elif '\\' not in text:
    print(0)
    print(0)
else :
    height_map = hightMapGenerator(text)
    # print(height_map)
    all_ponds = pondChecker(text, height_map)
    if all_ponds == []:
        print(0)
        print(0)
    else :
        # print(all_ponds)
        sliced_ponds_str, sliced_height_map = slicedPondsGenerator(text, height_map, all_ponds)
        # print(ponds_str)
        # print(sliced_height_map)
        squares = []
        for n, pond_str in enumerate(sliced_ponds_str):
            square = squareCalc(pond_str, sliced_height_map[n])
            squares.append(square)

        size_of_ponds = sum(squares)
        num_of_ponds = len(squares)
        output = ' '.join([str(n) for n in squares])
        print(size_of_ponds)
        print(num_of_ponds,output)
