# -*- coding: utf-8 -*-

def main():
    input_string = raw_input().strip()
    down_positions = []
    ponds = []
    for index, value in enumerate(input_string):
        if value == '\\':
            down_positions.append(index)
        elif value == '/' and down_positions:
            right = index
            left = down_positions.pop()
            area = right - left
            candidate_pond = []
            while ponds and left < ponds[-1][0]:
               candidate_pond.append(ponds.pop(-1))

            new_pond = (left, area + sum([x[1] for x in candidate_pond]))
            ponds.append(new_pond)
    
    print sum(x[1] for x in ponds)
    print len(ponds), 
    for pond in ponds:
        print pond[1], 

if __name__ == '__main__':
    main() def main():
    input_string = raw_input().strip()
    down_positions = []
    ponds = []
    for index, value in enumerate(input_string):
        if value == '\\':
            down_positions.append(index)
        elif value == '/' and down_positions:
            right = index
            left = down_positions.pop()
            area = right - left
            candidate_pond = []
            while ponds and left < ponds[-1][0]:
               candidate_pond.append(ponds.pop(-1))

            new_pond = (left, area + sum([x[1] for x in candidate_pond]))
            ponds.append(new_pond)
    
    print sum(x[1] for x in ponds)
    print len(ponds), 
    for pond in ponds:
        print pond[1],  main input_string = raw_input().strip() input_string raw_input().strip() ().strip () raw_input strip down_positions = [] down_positions [] ponds = [] ponds [] for index, value in enumerate(input_string):
        if value == '\\':
            down_positions.append(index)
        elif value == '/' and down_positions:
            right = index
            left = down_positions.pop()
            area = right - left
            candidate_pond = []
            while ponds and left < ponds[-1][0]:
               candidate_pond.append(ponds.pop(-1))

            new_pond = (left, area + sum([x[1] for x in candidate_pond]))
            ponds.append(new_pond)
    
     index value enumerate(input_string) enumerate input_string if value == '\\':
            down_positions.append(index)
        elif value == '/' and down_positions:
            right = index
            left = down_positions.pop()
            area = right - left
            candidate_pond = []
            while ponds and left < ponds[-1][0]:
               candidate_pond.append(ponds.pop(-1))

            new_pond = (left, area + sum([x[1] for x in candidate_pond]))
            ponds.append(new_pond)
    
     value == '\\' value '\\' down_positions.append(index) down_positions.append down_positions append index elif value == '/' and down_positions:
            right = index
            left = down_positions.pop()
            area = right - left
            candidate_pond = []
            while ponds and left < ponds[-1][0]:
               candidate_pond.append(ponds.pop(-1))

            new_pond = (left, area + sum([x[1] for x in candidate_pond]))
            ponds.append(new_pond)
    
     value == '/' and down_positions value == '/' value '/' down_positions right = index right index left = down_positions.pop() left down_positions.pop() down_positions.pop down_positions pop area = right - left area right - left right left candidate_pond = [] candidate_pond [] while ponds and left < ponds[-1][0]:
               candidate_pond.append(ponds.pop(-1))

             ponds and left < ponds[-1][0] ponds left < ponds[-1][0] left ponds[-1][0] [-1] ponds -1 0 candidate_pond.append(ponds.pop(-1)) candidate_pond.append candidate_pond append ponds.pop(-1) ponds.pop ponds pop -1 x[1] for x in candidate_pond for x in candidate_pond x candidate_pond for x in candidate_pond x[1] x 1 new_pond = (left, area + sum([x[1] for x in candidate_pond])) new_pond (left, area + sum([x[1] for x in candidate_pond])) left area + sum([x[1] for x in candidate_pond]) area sum([x[1] for x in candidate_pond]) sum [x[1] for x in candidate_pond] ponds.append(new_pond) ponds.append ponds append new_pond print sum(x[1] for x in ponds) sum x[1] x 1 print len(ponds) len ponds for pond in ponds:
        print pond[1],  pond ponds print pond[1] pond 1 if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    input_string = raw_input().strip()
    down_positions = []
    ponds = []
    for index, value in enumerate(input_string):
        if value == '\\':
            down_positions.append(index)
        elif value == '/' and down_positions:
            right = index
            left = down_positions.pop()
            area = right - left
            candidate_pond = []
            while ponds and left < ponds[-1][0]:
               candidate_pond.append(ponds.pop(-1))

            new_pond = (left, area + sum([x[1] for x in candidate_pond]))
            ponds.append(new_pond)
    
    print sum(x[1] for x in ponds)
    print len(ponds), 
    for pond in ponds:
        print pond[1],  def main():
    input_string = raw_input().strip()
    down_positions = []
    ponds = []
    for index, value in enumerate(input_string):
        if value == '\\':
            down_positions.append(index)
        elif value == '/' and down_positions:
            right = index
            left = down_positions.pop()
            area = right - left
            candidate_pond = []
            while ponds and left < ponds[-1][0]:
               candidate_pond.append(ponds.pop(-1))

            new_pond = (left, area + sum([x[1] for x in candidate_pond]))
            ponds.append(new_pond)
    
    print sum(x[1] for x in ponds)
    print len(ponds), 
    for pond in ponds:
        print pond[1],  main
# -*- coding: utf-8 -*-

def main():
    input_string = raw_input().strip()
    down_positions = []
    ponds = []
    for index, value in enumerate(input_string):
        if value == '\\':
            down_positions.append(index)
        elif value == '/' and down_positions:
            right = index
            left = down_positions.pop()
            area = right - left
            candidate_pond = []
            while ponds and left < ponds[-1][0]:
               candidate_pond.append(ponds.pop(-1))

            new_pond = (left, area + sum([x[1] for x in candidate_pond]))
            ponds.append(new_pond)
    
    print sum(x[1] for x in ponds)
    print len(ponds), 
    for pond in ponds:
        print pond[1], 

if __name__ == '__main__':
    main()