diagram = input()

water_all = 0
water = 0
ip = 0
stack1 = []
stack2 = []

for i, symbol in enumerate(diagram):
    if symbol == '\\': # 一つのバックスラッシュはこう書くらしい
        stack1.append(i)
    elif symbol == '/':
        if stack1 != []:
            ip = stack1.pop()
            water = i - ip
            water_all += water
            
            if stack2 != []:
                while stack2[-1][0] > ip:
                    i2, water2 = stack2.pop()
                    water += water2
                    if stack2 == []:
                        break
                stack2.append([ip, water])
            else:
                stack2.append([ip, water])

s = str(len(stack2))
waters = [str(i[1]) for i in stack2]
if len(waters)!=0:
    s += ' ' + ' '.join(waters)

print(water_all)
print(s) diagram = input() diagram input() input water_all = 0 water_all 0 water = 0 water 0 ip = 0 ip 0 stack1 = [] stack1 [] stack2 = [] stack2 [] for i, symbol in enumerate(diagram):
    if symbol == '\\': # 一つのバックスラッシュはこう書くらしい
        stack1.append(i)
    elif symbol == '/':
        if stack1 != []:
            ip = stack1.pop()
            water = i - ip
            water_all += water
            
            if stack2 != []:
                while stack2[-1][0] > ip:
                    i2, water2 = stack2.pop()
                    water += water2
                    if stack2 == []:
                        break
                stack2.append([ip, water])
            else:
                stack2.append([ip, water]) i symbol enumerate(diagram) enumerate diagram if symbol == '\\': # 一つのバックスラッシュはこう書くらしい
        stack1.append(i)
    elif symbol == '/':
        if stack1 != []:
            ip = stack1.pop()
            water = i - ip
            water_all += water
            
            if stack2 != []:
                while stack2[-1][0] > ip:
                    i2, water2 = stack2.pop()
                    water += water2
                    if stack2 == []:
                        break
                stack2.append([ip, water])
            else:
                stack2.append([ip, water]) symbol == '\\' symbol '\\' stack1.append(i) stack1.append stack1 append i elif symbol == '/':
        if stack1 != []:
            ip = stack1.pop()
            water = i - ip
            water_all += water
            
            if stack2 != []:
                while stack2[-1][0] > ip:
                    i2, water2 = stack2.pop()
                    water += water2
                    if stack2 == []:
                        break
                stack2.append([ip, water])
            else:
                stack2.append([ip, water]) symbol == '/' symbol '/' if stack1 != []:
            ip = stack1.pop()
            water = i - ip
            water_all += water
            
            if stack2 != []:
                while stack2[-1][0] > ip:
                    i2, water2 = stack2.pop()
                    water += water2
                    if stack2 == []:
                        break
                stack2.append([ip, water])
            else:
                stack2.append([ip, water]) stack1 != [] stack1 [] ip = stack1.pop() ip stack1.pop() stack1.pop stack1 pop water = i - ip water i - ip i ip water_all += water water_all water if stack2 != []:
                while stack2[-1][0] > ip:
                    i2, water2 = stack2.pop()
                    water += water2
                    if stack2 == []:
                        break
                stack2.append([ip, water])
            else:
                stack2.append([ip, water]) stack2 != [] stack2 [] while stack2[-1][0] > ip:
                    i2, water2 = stack2.pop()
                    water += water2
                    if stack2 == []:
                        break
                 stack2[-1][0] > ip stack2[-1][0] [-1] stack2 -1 0 ip i2, water2 = stack2.pop() i2 stack2.pop() stack2.pop stack2 pop water2 water += water2 water water2 if stack2 == []:
                        break
                 stack2 == [] stack2 [] break stack2.append([ip, water]) stack2.append stack2 append [ip, water] ip water stack2.append([ip, water]) stack2.append stack2 append [ip, water] ip water s = str(len(stack2)) s str(len(stack2)) str len(stack2) len stack2 str(i[1]) for i in stack2 for i in stack2 i stack2 for i in stack2 str(i[1]) str i[1] i 1 waters = [str(i[1]) for i in stack2] waters [str(i[1]) for i in stack2] if len(waters)!=0:
    s += ' ' + ' '.join(waters) len(waters)!=0 len(waters) len waters 0 s += ' ' + ' '.join(waters) s ' ' + ' '.join(waters) ' ' ' '.join(waters) ' '.join ' ' join waters print(water_all) print water_all print(s) print s s += ' ' + ' '.join(waters) ' ' + ' '.join(waters) s diagram = input() input() diagram waters = [str(i[1]) for i in stack2] [str(i[1]) for i in stack2] waters water_all = 0 0 water_all stack1 = [] [] stack1 ip = stack1.pop() stack1.pop() ip stack2 = [] [] stack2 water = i - ip i - ip water water_all += water water water_all water2 = stack2.pop() stack2.pop() water2 ip = 0 0 ip water = 0 0 water water += water2 water2 water i2, water2 = stack2.pop() stack2.pop() i2 s = str(len(stack2)) str(len(stack2)) s
diagram = input()

water_all = 0
water = 0
ip = 0
stack1 = []
stack2 = []

for i, symbol in enumerate(diagram):
    if symbol == '\\': # 一つのバックスラッシュはこう書くらしい
        stack1.append(i)
    elif symbol == '/':
        if stack1 != []:
            ip = stack1.pop()
            water = i - ip
            water_all += water
            
            if stack2 != []:
                while stack2[-1][0] > ip:
                    i2, water2 = stack2.pop()
                    water += water2
                    if stack2 == []:
                        break
                stack2.append([ip, water])
            else:
                stack2.append([ip, water])

s = str(len(stack2))
waters = [str(i[1]) for i in stack2]
if len(waters)!=0:
    s += ' ' + ' '.join(waters)

print(water_all)
print(s)
